Reputation: 3444
I have a file I would like to
Easier to understand with a diagram:
I tried that without success:
sed -e "s/\(.*\)161$/ /" $FICSUP$EXTMOD
Data:
CRE M 0123456 01/01/2016 ZDCP H125,45
CRE M 0123456 01/01/2016 ZDRTT H170
CRE M 0123456 01/01/2016 ZDRTTN-1 H130
CRE M 0123456 01/01/2016 ZDCPA H200
CRE M 0123457 01/01/2016 ZDCP H124,45
Upvotes: -1
Views: 52
Reputation: 1195
Assuming that you want to:
Using your data as input here is what the result looks like Remove the "."s in the regex with however many spaces you need. I have used "." to make the whitespace visible.
$ cat data | sed -r "s/[0-9,]* *$/..................../"
CRE M 0123456 01/01/2016 ZDCP H....................
CRE M 0123456 01/01/2016 ZDRTT H....................
CRE M 0123456 01/01/2016 ZDRTTN-1 H....................
CRE M 0123456 01/01/2016 ZDCPA H....................
CRE M 0123457 01/01/2016 ZDCP H....................
Upvotes: 0
Reputation: 2375
This should do the trick:
sed "s/[0-9]\+[,]*[0-9]*$/ /g" your_file.txt
This replaces every number (including the comma) at the end of the line with 8 spaces.
Upvotes: 0