Re: [gentoo-user] Re: [OT] Bash scripting

2005-11-11 Thread Stroller
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

[gentoo-user] Re: [OT] Bash scripting 2

2005-11-11 Thread Peper
> 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

Re: [gentoo-user] Re: [OT] Bash scripting

2005-11-11 Thread Billy Holmes
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

Re: [gentoo-user] Re: [OT] Bash scripting

2005-11-11 Thread Alexander Skwar
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

[gentoo-user] Re: [OT] Bash scripting 2

2005-11-11 Thread Peper
> $ dirname /etc/conf.d/net > /etc/conf.d That's what i need, many thanks! -- Best Regards, Peper -- gentoo-user@gentoo.org mailing list

[gentoo-user] Re: [OT] Bash scripting

2005-11-11 Thread Peper
> 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

Re: [gentoo-user] Re: [OT] Bash scripting

2005-11-11 Thread davidgn
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

[gentoo-user] Re: [OT] Bash scripting

2005-11-11 Thread Peper
> > 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

Re: [gentoo-user] Re: [OT] Bash scripting

2005-11-11 Thread Etaoin Shrdlu
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

[gentoo-user] Re: [OT] Bash scripting

2005-11-11 Thread Peper
> 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 -

Re: [gentoo-user] Re: [OT] Bash scripting

2005-11-11 Thread Stoian Ivanov
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

[gentoo-user] Re: [OT] Bash scripting

2005-11-11 Thread Peper
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