I have a csv file in which there are numbers like
078976/9XXX 098754/8XXX
I want to replace the XXX with null. I want to know the command/code to do this. I know how to replace the whole word/number. But don't know how to replace a part of it.
Thanks in advance, Mihir
if you know its always going to be the last 3 characters,
# echo "078976/9XXX"|sed 's/...$//g' 078976/9
while read str do echo ${str%???} done < file
Another way always with sed :
$ cat seqs.txt 999999/5 123456/1XXX 010101/22B12 $ sed 's!\(/[0-9]\{1,\}\).*$!\1!' seqs.txt 999999/5 123456/1 010101/22 $