![]() |
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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| column extract help | cvm | Shell Programming and Scripting | 1 | 04-24-2008 04:19 PM |
| How to extract the PID from 'ps -ef' | nsinha | Shell Programming and Scripting | 7 | 11-20-2006 07:47 AM |
| Please help! Sed extract a pattern | zhen | Shell Programming and Scripting | 11 | 09-18-2006 12:36 PM |
| tar. I can't extract | volleyboy | UNIX for Dummies Questions & Answers | 1 | 02-17-2006 11:54 AM |
| extract from TAR | big123456 | UNIX for Advanced & Expert Users | 8 | 07-28-2005 03:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
extract using sed/awk - need help? Please!!
Need help..not sure how to use with awk or sed
I want to take data from the notification.$$ file and assign the data to variable "group". Not sure how to do it. The data I want to extract from the notification.$$ is on the first line of the file ..right after the (notice): NetWorker savegroup: (notice) EGL completed, 1 # This script sends email that save group completed. 2 #!/bin/sh 3 group=" " 4 dat=`date +"%c"` 5 log='/nsr/logs/test_savegrp.log' 6 echo "\n -- BUR Legato $dat Test Save Group Notification -- \n" >> $log 7 tee notification.$$ >> $log 8 group=`grep -l notice 9 echo " -- $dat end of $group Savegroup Message --\n" >> $log 10 awk " 11 /usr/ucb/mail -s "$dat $group-BUR Networker Savegroup Completion Report" xxx.email < notification.$$ >> $log 2>&1 ~ ~ |
|
||||
|
do this
grp=`grep notice 20071008_1105_savegroup.txt | awk '{print $4}'` or grp =`grep notice 20071008_1105_savegroup.txt | cut -d'delimeter' -f4` or grp =`awk '/notice/{print $4}'` cheers, Devaraj Takhellambam |
|
||||
|
But It still will not pass my $4 to where I need to print it. How can I assign that $4 to a variable to save.
1 # This script sends email that save group completed. 2 #!/bin/sh 3 dat=`date +"%c"` 4 log='/nsr/logs/savegrp.log' 5 echo "\n -- $4 BUR Legato $dat Save Group Notification -- \n" >> $log 6 tee -a notification.$$ >> $log 7 grep notice notification.$$ 8 awk '{print $4}' 9 grp=`awk '{print $4}` 10 echo " -- end of $grp Savegroup Message --\n" >>$log 11 sudo /usr/ucb/mail -s "$dat $4 Networker Savegroup Completion Report" mailxxx.com < notification.$$ >> $ log 2>&1 |
|
||||
|
1 # This script sends email that save group completed.
2 #!/bin/sh 3 dat=`date +"%c"` 4 log='/nsr/logs/savegrp.log' 5 echo "\n -- $4 BUR Legato $dat Save Group Notification -- \n" >> $log 6 tee -a notification.$$ >> $log 7 grep notice notification.$$ 8 awk '/notice/{print $4}' notification.$$ 9 grp =`awk '/notice/{print $4}' notification.$$ ` 10 echo " -- end of $grp Savegroup Message --\n" >>$log 11 sudo /usr/ucb/mail -s "$dat $grp Networker Savegroup Completion Report" mailxxx.com < notification.$$ >> $ log 2>&1 cheers, Devaraj Takhellambam |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|