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

How can print a list of differences in many files

Status
Not open for further replies.

Damaged

Technical User
Sep 25, 2002
2
CA
I am new to unix and have a directory containing a large number of user sub-directories, each containing a file called .profile
Inside each .profile file there is a line showing the terminal number.
If I want a list showing the user directory name and the corresponding terminal number, how would I go about doing this?
Below is a cut out from the .profile file. (LINE=135 is the terminal number.)

Code:
# For Network Terminal Server Login.
LINE=135                   ; export LINE     # TERMINAL_NUMBER set by user scrip
t
 
The following should do what you want.

find . -name .profile | xargs grep LINE= | awk '{print $1}'
 
awk can save on using the grep cmd.

find . -name .profile | xargs awk '/LINE=/{print $1}' Cheers,
ND [smile]

bigoldbulldog@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top