I have a csv file which is of roughly the following format,
name | image | wht | type | zt | dir |
---|---|---|---|---|---|
sally | sally.fits | wht.fits | map | 100 | /users/ |
but with many more rows than shown in this example.
I am trying to remove the first occurrence of the word subset '.fits' from every single row in the file.
So for this example, it would change sally.fits
to sally
but leave wht.fits
untouched.
I know to remove the first occurrence of a word in every file and/or replace it with another can be done with,
:s/wordtofind/wordtoreplaceitwith/
and so I tried amending this command as such,
:%s/\.fits/
where %s
applies it to every line but I omit /g
as I want to remove .fits
only the first time it appears on every row (not every occurrence). The \
escapes the dot and nothing after the final /
as I don't want to replace it with anything. This was based on a couple other SO posts but this just gave an error saying the combination was not found.
The files are small enough that I can manually delete the combinations but out of curiosity, would anyone know how to go about doing this? or can see where I've gone wrong? any insight would be much appreciated.