ric79
1
Hi all,
my syslog.txt is a file like this:
Jan 20 10:55:19 cerbero | process1: process1.--: [ID 379539 local1.info] |Info |xyxyxyxyxyxyxx |
Jan 20 10:59:45 cerbero | processlong2 : threadlong1.0 : [ID 379539 local1.info] |Info |ughxueeughxueeuxexuexueuxexuexue |
I need a .sh script to print to screen something like this.
Jan 20 10:55:19 | process1: ___________process1.--: ___________|Info |xyxyxyxyxyxyxx |
Jan 20 10:59:45 | processlong2 : _____threadlong1.0 : ________|Info |ughxueeuxexuexueughxueeuxexuexue |
I'm not able to display here spaces instead of "_" but I need space-padding (i.e. 20 space char)
Thanks to all,
Riccardo
clx
2
will this work?
sed -e 's/: /: /g' -e 's/: .*\]/: /g' file
frans
3
something like
cut syslog.txt -d'|' -f2 | sed 's/\[.*\]//g' | awk -F=":" '{printf ("%15s %15s\n", $1, $2); }'
Is not complete but works on what needs to be modified in the file.
ric79
4
Hi all, thanks for suggestion.
I need to split all the rows using as field separator " " or ":" or "|" or "[" or "]"
For example:
Jan 20 10:55:19 cerbero | process1: process1.--: [ID 379539 local1.info] |Info |xyxyxyxyxyxyxx |
Jan
20
10
55
19
cerbero
process1
process1.--
ID
379539
local1.info
....
By this way I can use awk and printf to create a new custom line...
When I use AKW FS = [ \|\[\]:] I don't have to expected result...
Riccardo