On Nov 11, 2005, at 2:12 pm, Peper wrote:
And one more thing, is there any smarter way to read one line of file
then
head -n x file|tail -n 1 ?
Surely so:
$ echo 'blahpath="/path/to/blahdir"' >> configfile
$ echo $blahpath
$ source configfile
$ echo
> file=/etc/conf.d/net
> echo ${file%/*}
I've gotten it working with dirname already, but this one is nice ;] Thanks
for help.
--
Best Regards,
Peper
--
gentoo-user@gentoo.org mailing list
Peper wrote:
And one more thing, is there any smarter way to read one line of file then
head -n x file|tail -n 1 ?
if you know the line number from the top:
sed -n ${line}p
if you don't know the number from the top but from the bottom, then tail
| tail is your best bet...
--
gentoo-user@gen
Peper schrieb:
> And one more thing, is there any smarter way to read one line of file then
> head -n x file|tail -n 1 ?
sed.
http://sed.sourceforge.net/sed1line.txt
|[...]
| SELECTIVE PRINTING OF CERTAIN LINES:
|[...]
# print line number 52
sed -n '52p' # method 1
sed '52!d
> $ dirname /etc/conf.d/net
> /etc/conf.d
That's what i need, many thanks!
--
Best Regards,
Peper
--
gentoo-user@gentoo.org mailing list
> try with eval then:
Many thanks! I'd tried it before, but you showed me how to use it in proper
way.
--
Best Regards,
Peper
--
gentoo-user@gentoo.org mailing list
Quoting Peper <[EMAIL PROTECTED]>:
> > try
> > blah=`pwd`'/blah'
> >
> > *Note the single quotes do not enclose `pwd`
>
> I know how to use `command`, but the problem is that i read blah from
> file.
> blah=`head -n x file|tail -n 1` and in the file i have lines `pwd`/blah.
>
> $ echo $blah
> `p
> > And one more thing, is there any smarter way to read one line of file
> > then head -n x file|tail -n 1 ?
>
> sed -n -e '12p' file.txt
>
> prints the 12th line of "file.txt"
Many thanks for that.
--
Best Regards,
Peper
--
gentoo-user@gentoo.org mailing list
On Friday 11 November 2005 15:12, Peper wrote:
> And one more thing, is there any smarter way to read one line of file
> then head -n x file|tail -n 1 ?
sed -n -e '12p' file.txt
prints the 12th line of "file.txt"
--
gentoo-user@gentoo.org mailing list
> try
> blah=`pwd`'/blah'
>
> *Note the single quotes do not enclose `pwd`
I know how to use `command`, but the problem is that i read blah from file.
blah=`head -n x file|tail -n 1` and in the file i have lines `pwd`/blah.
$ echo $blah
`pwd`/blah
This is the problem.
--
Best Regards,
Peper
-
On Friday 11 November 2005 16:12, Peper wrote:
> And one more thing, is there any smarter way to read one line of file then
> head -n x file|tail -n 1 ?
>
> --
> Best Regards,
> Peper
awk is your friend
bash's read is your friend
google is your friend
--
gentoo-user@gentoo.org mailing list
And one more thing, is there any smarter way to read one line of file then
head -n x file|tail -n 1 ?
--
Best Regards,
Peper
--
gentoo-user@gentoo.org mailing list
12 matches
Mail list logo