Let's say I have
"a b [email protected] c /dir/foo/bar/last2/notneeded"
Using awk, how can I print this out as:
"a b user c server group /dir/foo/bar"
Where I need to rearrange the order of some things as well as use different separators for each sub field and not include the last 2 pieces of path information within the directory structure?
My idea was to call
awk on the output of my
awk call, but that failed miserably.
EDIT for clarity:
Most of the data is space separated, but 2 of the fields have fields of their own. I want to be able to separate the
[email protected] into 3 separate fields as well as truncate the last 2 pieces of the path in
/dir/foo/bar/last2/notneeded to become