I have several of the same file names(facts) in different directories that are "|" pipe delimited and are like such:
PHP Code:
xxx.xxx.xxx.xx1|blah|a|host|FQDN|domain||extra stuff blah1 blah2 host
xxx.xxx.xxx.xx2|blah|a|host|FQDN|domain||extra stuff blah1 blah2 host
xxx.xxx.xxx.xx3|blah|a|host|FQDN|domain||extra stuff blah1 blah2 host
xxx.xxx.xxx.xx3|blah|a|host|FQDN|domain||extra stuff blah1 blah2 host
I have a need to only remove only the word "host" from the fourth field to produce:
PHP Code:
xxx.xxx.xxx.xx1|blah|a||FQDN|domain||extra stuff blah1 blah2 host
xxx.xxx.xxx.xx2|blah|a||FQDN|domain||extra stuff blah1 blah2 host
xxx.xxx.xxx.xx3|blah|a||FQDN|domain||extra stuff blah1 blah2 host
xxx.xxx.xxx.xx3|blah|a||FQDN|domain||extra stuff blah1 blah2 host
This appears to work:
PHP Code:
find results/ -iname 'host' -print0|xargs -0 awk -F\| '$4 ~/host/'|sed 's/host//'
xxx.xxx.xxx.xx1|blah|a||FQDN|domain||extra stuff blah1 blah2 host
xxx.xxx.xxx.xx2|blah|a||FQDN|domain||extra stuff blah1 blah2 host
xxx.xxx.xxx.xx3|blah|a||FQDN|domain||extra stuff blah1 blah2 host
xxx.xxx.xxx.xx3|blah|a||FQDN|domain||extra stuff blah1 blah2 host
but when I attempt to implement it using the "i" in sed, I get:
PHP Code:
find results/ -iname 'facts' -print0|xargs -0 awk -F\| '$4 ~/host/'|sed -i 's/host//'
sed: no input files
xargs: awk: terminated by signal 13
I have tried several different variation using grep
PHP Code:
grep -ir '*' results/*/facts|gawk -F '|' '{IGNORECASE=1;} ($4) ~/host/ {print $0}'|sed -i 's/host//'
doesnt find anything. ???