Reputation: 611
I would like to print an output text in 4 columns:
SharedCacheMap 0xb89e9720 None \Device\HarddiskVolume1\Windows\System32\WWanAPI.dll
ImageSectionObject 0xb89ea5f8 None \Device\HarddiskVolume1\Program Files\McAfee\Host Intrusion Prevention\Resource\0409\McTrayHipRL.dll
DataSectionObject 0xb89ea5f8 None \Device\HarddiskVolume1\Program Files\McAfee\Host Intrusion Prevention\Resource\0409\McTrayHipRL.dll
I tried:
column -s " " -t
I don't know how to handle the spaces in the file pathes.
Thanks in advance for your help!
Upvotes: 1
Views: 49
Reputation: 1726
with sed removing spaces only in filenames strings
cat yourfile.txt | sed 's/[^\]*\\/&\$\n/' | sed '2~2 s/ //g' | sed ':a; N; $! ba; s/\$\n//g'
or replace them with %20
cat yourfile.txt | sed 's/[^\]*\\/&\$\n/' | sed '2~2 s/ /%20/g' | sed ':a; N; $! ba; s/\$\n//g'
Upvotes: 0
Reputation: 88583
Try this:
while read -r c1 c2 c3 rest; do printf "%-20s %-12s %-8s %s\n" "$c1" "$c2" "$c3" "$rest"; done < file
Output:
SharedCacheMap 0xb89e9720 None \Device\HarddiskVolume1\Windows\System32\WWanAPI.dll ImageSectionObject 0xb89ea5f8 None \Device\HarddiskVolume1\Program Files\McAfee\Host Intrusion Prevention\Resource\0409\McTrayHipRL.dll DataSectionObject 0xb89ea5f8 None \Device\HarddiskVolume1\Program Files\McAfee\Host Intrusion Prevention\Resource\0409\McTrayHipRL.dll
Upvotes: 1