Dear all,
Is there any one can show me how to get a single line from a test file. What
command should I use and how?
Best Regards,
GY
Is there any one can show me how to get a single line from a test file. What
command should I use and how?
Best Regards,
GY
Eike
> Dear all,
> Is there any one can show me how to get a single line from a test file. What
> command should I use and how?
> Best Regards,
> GY
Eike Rietzel
Gesellschaft fuer Schwerionenforschung
Biophysik
Planckstr. 1
64291 Darmstadt
fon: +49-6159-71-2156
fax: +49-6159-71-2106
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> using ksh:
> read VARIABLE < testfile
> or
> VARIABLE=`line < testfile`
> Eike
sed -n '6p' datafile
To get a the 4th line that doesn't have a # as the first char, try:
sed -n '/^[^#]/p' datafile |sed -n '4p'
It really depends on what you consider your "line" requirements.
- matt
--
AIX and HACMP Certified Specialist | | / \ |\| | \. ,_| _| --
/ Comments, views, and opinions \ | |_/ ^ \| | ) | | \, *_)
\ are mine alone, not IBM's. / |___|/~\_\_|\|__/|_| \(
awk 'NR==6' testfile
(to get the 6th line)
Tristan.
> > using ksh:
> > read VARIABLE < testfile
> > or
> > VARIABLE=`line < testfile`
> > Eike
> That's good for getting the FIRST line of the test file. To get line 6
> try:
> sed -n '6p' datafile
> To get a the 4th line that doesn't have a # as the first char, try:
> sed -n '/^[^#]/p' datafile |sed -n '4p'
> It really depends on what you consider your "line" requirements.
> - matt
This also works if $n is a regular expression contained in /s:
n='/foo/'
sed "${n}q;d"
or:
sed '/foo/q;d'
--Ken Pizzini
1. how to split a single colume file into multi-colume?
Hi:
How could I split a file with a single colume of data into multicolume?
That is:
123
123
123
123
123
into :
123 123 123
123 123 123....
what is the simplest way to do it?
Thanks in advanced.
2. eth0 delayed initialization
3. Cut the first and the last line
4. 2.6 not seeing SCSI devices
5. Cut away first and last 3 lines
6. LInks suggested here categorized 11 Aug
7. how does one cut fields from lines
8. Help with argv manipulation
9. "ls" output or "cut" action: restricting to one line?
10. Cut first line from a file!
11. LJ4L cutting off top of first line?
12. one liner which prints n lines before and m lines after the line found by grep
13. Veritas: How to make a rootdg with one slice instead of one disk