Please if I could get some help on the following, I have data files (due to 3rd party mistake) within each data file on line/row 3 column/field 3 - there is value '1' that need to be changed to '0'.
For example:
HEAD, TYPE OF FILE
NAME,ADDRESS
M,TYPE, 1
Now initially only two data files had the problem, so I was manually changing the 1 to 0 (as the 1 shown above) - but now I've found over 1000 files that actually have the problem (and apparently need to be changed to 0 in the next two hours). I trying to write a Unix script that does all files in one go by using AWK and SED command, or any, But I'm getting no way, any suggestion (all are welcome) .....
I've been getting syntax errors... but I've looked at this from different approaches (also taking in account your suggestion) and I've come up with this:
---
for x in `find . -size -9000` ;do sed 's/TYPE,1/TYPE,0/' <$x> $x.new;
rm $x;
mv "$x.new" /usr/local/data/backdata"$x";
echo "$x" >> ./logfile
done
-------
But I haven't been able to test it 'cause to add to my great day the server gone done, ha!!
---------- Post updated at 10:20 AM ---------- Previous update was at 06:41 AM ----------
thanx for the Franklin52....I have it working, it was jerkin me about on the rename, but with a suggestion I moved it to another directory first.
---------- Post updated at 10:20 AM ---------- Previous update was at 10:20 AM ----------
thanx for the Franklin52....I have it working, it was jerkin me about on the rename, but with a suggestion I moved it to another directory first.