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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function for line-managment

Status
Not open for further replies.

eustathi

Technical User
May 9, 2007
9
0
0
GR
Hello

I am new in unix . I would be grateful if you could help me , i want to manage lines of a text file for example i want to do [grep sth] for the first file(first line) of the text file.
i use this code
Code:
ls -lR | awk ' BEGIN {print "LIST OF ALL FILES"} /[-]rw*/ {print $9} END {print " FINISH"}' > filesystem.txt

Thanks in advance
 
Try this:

Code:
echo "LIST OF FIRST LINE OF ALL FILES"
find . -type f -exec head -1 {} \;
echo " FINISH"
[3eyes]



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
I want to manage each line for example Variable= 6th line
 
This then?

Code:
LINE=8
echo "LIST OF LINES number ${LINE} OF ALL FILES"
find . -type f -exec awk "NR==$LINE" {} \;
echo " FINISH"


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top