Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SED problem 1

Status
Not open for further replies.
Nov 24, 2004
159
GB
Hi

I have a file called vol.txt conataiing a list of volumes

I want to print the firtds line into a variable

I was running this

VOL="$(cat /tmp/vol.txt | sed -n '1p')"

the output was

ML1234L3: No such file or directory

What am i doing wrong here
 
Hi

[ul]
[li]That is UUOC
Code:
VOL="$( sed -n '1p' /tmp/vol.txt )"
[/li]
[li]That is overkill
Code:
VOL="$( head -1 /tmp/vol.txt )"
[/li]
[li]That is needless
Code:
read VOL < /tmp/vol.txt
[/li]
[/ul]

Feherke.
 
Hi

I forgot to say, there is no error in your code, the message must come from other part.

Are you sure the /tmp/vol.txt file's first line is not literally "ML1234L3: No such file or directory" ?

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top