![]() |
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 |
| how to show it on separate line | userking | UNIX for Dummies Questions & Answers | 2 | 07-23-2008 01:01 AM |
| Separate lines in a single '|' separated line | hidnana | Shell Programming and Scripting | 3 | 03-17-2008 10:16 AM |
| unable to display the souce line in gdb | gauri | UNIX for Dummies Questions & Answers | 4 | 04-19-2007 08:36 PM |
| Display a particular line from a file | Rohini Vijay | Shell Programming and Scripting | 5 | 07-31-2006 07:27 AM |
| Listing words from a file on a Separate Line | Astudent | UNIX for Dummies Questions & Answers | 2 | 03-14-2001 06:44 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I would like to separate a line and display accordingly..
Hi all,
I have a log file which writes some information in it; now i've written a script to read particular line and print.. (shown below) ('20080920212141','net','Q05','DB','0','20080921064023','netbackup','netbackup') Am using print $7 where this writes the entire details which are in ( .... ) I would like to have only start date and end date from it.. Can anyone help me plz.. |
|
||||
|
Quote:
How to deal this with sed command? When I try this, i got the following error: Code:
echo "('20080920212141','net','Q05','DB','0','20080921064023','netbackup','netbackup')" |sed -e 's/.*\(//' -e 's/\)*//'
Code:
sed: -e expression #1, char 8: Unmatched ( or \( Last edited by tpltp; 09-22-2008 at 03:37 AM.. Reason: forgot to input the error message |
|
||||
|
Quote:
Code:
echo $temp | awk -F'[(|,|)]' '{print $2, $7}'
|
|
||||
|
Quote:
Hi.. thank you very much for all experts... :-) It really helped me.. however i could not figure out the exact figure to get the output.. Acutally iam greping for a last line in some log file... (ex: grep insert).. which inturns search for the last line using tail -1 and updates the another log files with the entires... The line exactly looks like is... (below) new 1: insert into sapqd1.sdbah values ('20080725011009','net','QD1','DB','0','20080725052004','netbackup','netbackup') This is a single line from which am trying to get the Start, End and the RC=0 from it.. Now when i use this tr command i dont know how many single cotts and brack's should be given.. (please help) I am using the below script to write the particular line to a log file... ssh -l ora${sid} ${primaryhost} "tail -50 /oracle/$ORACLE_SID/newbackup/END_BACKUP.log" |grep 'insert' |tail -1| awk '{print $7}' >> ${RESULTFILE} which prints from open braket's $7 from the log file.. i.e ('20080920212141','net','Q05','DB','0','20080921064023','netbackup','netbackup').. Now if i want to read only the start and end time how do i write the tr command... And also if possible can you please do me a favour to display the the same time in our own format (anything like below): 2008/09/20/ 21:21:41 Sat Sep 20 21:21:41 Any changes would be really appreciated.. thanking you in advance.. |
|
||||
|
Your sed script probably doesn't do what you want it to. The \( and \) should be in the same command because they are used for grouping. If you are trying to replace literal parentheses with nothing, take away the backslashes (and probably the .* and especially the erroneous last * after the closing parenthesis). Or better still, use tr -d '()' < file or the near-equivalent sed 's/[()]//g'
|
|
||||
|
Hi.. thank you very much for all experts... :-)
It really helped me.. however i could not figure out the exact figure to get the output.. Acutally iam greping for a last line in some log file... (ex: grep insert).. which inturns search for the last line using tail -1 and updates the another log files with the entires... The line exactly looks like is... (below) new 1: insert into sapqd1.sdbah values ('20080725011009','net','QD1','DB','0','20080725052004','netbackup','netbackup') This is a single line from which am trying to get the Start, End and the RC=0 from it.. Now when i use this tr command i dont know how many single cotts and brack's should be given.. (please help) I am using the below script to write the particular line to a log file... ssh -l ora${sid} ${primaryhost} "tail -50 /oracle/$ORACLE_SID/newbackup/END_BACKUP.log" |grep 'insert' |tail -1| awk '{print $7}' >> ${RESULTFILE} which prints from open braket's $7 from the log file.. i.e ('20080920212141','net','Q05','DB','0','20080921064023','netbackup','netbackup').. Now if i want to read only the start and end time how do i write the tr command... And also if possible can you please do me a favour to display the the same time in our own format (anything like below): 2008/09/20/ 21:21:41 Sat Sep 20 21:21:41 Any changes would be really appreciated.. thanking you in advance.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|