![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi ya
I need some help please I am trying to read an input file and look for occurrences of the current user who is executing the script. On finding an occurrence of the username take that line and append it to a file and display a line number and a bracket against the saved line. so far i created a file xx with env sent to it 5 times then i created this script but I only manged to get 1) next to each line that greped from the xx file which contained env 5 times: - echo "Enter the file name to search username: " read fileName egrep -w "PWD" $fileName | head -1 | nl -ba -w1 -s\) >> test egrep -w "USER" $fileName | head -1 | nl -ba -w1 -s\) >> test egrep -w "MAIL" $fileName | head -1 | nl -ba -w1 -s\) >> test egrep -w "LOGNAME" $fileName | head -1 | nl -ba -w1 -s\) >> test egrep -w "HOME" $fileName | head -1 | nl -ba -w1 -s\) >> test thanks in advance I have been racking my brains please help!!!!! |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|