I have a bunch of files with lots of rows configured like this:
what,r-crq,What,What,VAC5700-035080,What
i,pns11,I,I,VAC5700-035090,I
do,vdd,did,did,VAC5700-035100,did
I want to do a search and replace to end up with this, storing and reinserting the 4 numbers after VAC
and removing the trailing portion of the VAC
number:
what,r-crq,What,What,VAC5700,What
i,pns11,I,I,VAC5700,I
do,vdd,did,did,VAC5700,did
Is there a way to do this for all the files at once (the VAC
number will vary, so it needs to be stored as a variable), preferably in the Bash shell?
I assume I could also do this in “Notepad++” using regex, but I think the shell script would be preferable as I could do all the files as a batch.
VAC
number will vary, so it needs to be stored as a variable". I don't understand. I suspect that you're overthinking this — Steven's answer should do what you want. (And, if it does, you should accept it.) But, if his answer doesn't work for you, that suggests that you haven't explained your problem completely, correctly, and clearly.