![]() |
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 get the no. of lines in a text file | vimalr | Shell Programming and Scripting | 8 | 08-18-2009 02:42 PM |
| get only some lines from a text file | fadista | UNIX for Dummies Questions & Answers | 1 | 01-28-2009 06:15 AM |
| selecting only few lines from many based on a common pattern | damansingh | Shell Programming and Scripting | 2 | 05-28-2008 06:29 AM |
| command for selecting specific lines from a script | gardasgangadhar | UNIX for Dummies Questions & Answers | 1 | 05-13-2008 05:29 AM |
| Help with selecting specific lines in a large file | tansha | UNIX for Dummies Questions & Answers | 2 | 02-06-2008 08:26 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Excelent !
Thank you again danmero! ---------- Post updated at 10:51 AM ---------- Previous update was at 09:36 AM ---------- Hello Again, I am using this line: awk -F'\]|:' 'NF{line=$0;sub("^ ","",$2);sub(" ","_",$2); file="awk/"$2".out"; if ($2 !~ /W|Su|Nag|Fin|Ca|CU|Au|LOG|Loc|G/); print line >> file; close(file); }' file to remove unwanted types... now, on my previous script I was converting the [Timestamp] to date and adding ";" as separator piping awk...: awk '{FS=";"}{gsub(/SERVICE NOTIFICATION: |HOST NOTIFICATION: /,"")}{gsub(/\[1/,"1")}{gsub(/] /,";")}{t=strftime("%m/%d/%Y %T", $1 )}{print t";GMT -7;"w$0}'|awk 'BEGIN {FS=OFS=";"} $6=$7~/^h|^n/?"HOST STATUS;"$6:$6'|awk '{FS=OFS=","}{gsub(/;/,",")}{print $1","$2","$3","$4","$5","$6","$7","$8",\""$9 $10 $11 $12 $13 $14 $15 $16 $17"\""}' Is there any easy way to remove the [] from the timestamp, convert it to time and change the , to ; .... as you can see I am not that good at awk; so any advise is highly appreciated, to avoid piping commands. Regards, Oconmx |
|
||||
|
To keep the forums high quality for all users, please take the time to format your posts correctly.
Thank You. The UNIX and Linux Forums Reply With Quote Quote:
First you generate a file and now you try to fixit. Maybe you should generate the original file the way you like it from the beginning? |
![]() |
| Bookmarks |
| Tags |
| csv, log, perl, script, shell |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|