Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Using awk and output to files

$
0
0
I currently have this code:

Code:

awk ' BEGIN { FS = OFS = "|"} { l=length($1) $1 = sprintf("%s-%s-%s %s:%s:%s", substr($1, l - 13, 4), substr($1, l - 9, 2), substr($1, l - 7, 2), substr($1, l - 5, 2), substr($1, l - 3, 2), substr($1, l - 1)) print }' infile  exit
Lets say I also wanted to modify $11 in a different format, where would I begin that statement?

Also what does infile actually represent. I replaced "infile" with a specific file that I wanted the code to run on, but what if I wanted to run the code across a whole directory, or set of files?

Viewing all articles
Browse latest Browse all 16232

Trending Articles