![]() |
|
|
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 |
| display changing variable in one place on screen in ksh | raidzero | Shell Programming and Scripting | 7 | 09-25-2008 10:24 AM |
| rerun .profile after changing variable | sboxtops | AIX | 2 | 09-02-2008 03:19 PM |
| bash script execution with a variable in a single line | shoeb | Shell Programming and Scripting | 1 | 07-06-2008 05:14 AM |
| IFS changing the variable value | pvar | Shell Programming and Scripting | 1 | 02-25-2005 06:21 PM |
| Very simple question about changing PS1 variable at startup! | abidmalik | UNIX for Dummies Questions & Answers | 2 | 08-26-2002 02:05 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi all, im new to awk and would apreciate if you could tell me how to do this, i have a file with several entries like this: Code:
2008-09-09 21:57:45 44 403 CUSTOM_EVENT Upgrade - end1 2008-09-09 21:57:46 45 403 CUSTOM_EVENT Component Check - start 2008-09-09 21:57:56 46 403 CUSTOM_EVENT Component Check - end 2008-09-09 21:57:56 47 403 CUSTOM_EVENT OSChecksum - start 2008-09-09 21:59:15 48 403 CUSTOM_EVENT OSChecksum - end 2008-09-09 21:59:15 49 403 CUSTOM_EVENT SELLogCheck - start 2008-09-09 22:01:39 50 403 CUSTOM_EVENT SELLogCheck - end 2008-09-09 22:01:40 51 403 CUSTOM_EVENT USB to Serial Connection Test - start 2008-09-09 22:43:46 52 403 CUSTOM_EVENT USB to Serial Connection Test - start 2008-09-09 22:44:15 53 403 CUSTOM_EVENT MemoryCheck - start 2008-09-09 22:44:16 54 403 CUSTOM_EVENT MemoryCheck - end im trying to get the values on the last field, which would be the description of the event (eg. USB to Serial Connection Test - start) , but i need to further separate this field with a "-" to know if the test started or ended, the last field is a bit variable so i figured y could use something like this: cat $1 | awk '{description = $6" "$7" "$8" "$9" "$10" "$11" "$12" "$13" "$14" "$15 ; print description }' first i get all the fields from 6 to 15, and then, i tryed changing the FS to - and print the second field... cat $1 | awk '{description = $6" "$7" "$8" "$9" "$10" "$11" "$12" "$13" "$14" "$15 ; FS="-" ; print description $2}' of course, that prints the second field of the entire line, which is the year... hehe... is there a way to tell awk to output the variable's second field delimited by a "-"? thanks all
|
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|