- Aug
- 2,059
- 83
Hi,
The Unix utility SED provides the ability to delete a specific line from a file. For example, if I want to delete line 44 from my hosts file, saving the new file with a .bak extension, I can do so with the following SED command;
Is there a simple way to do this in TCC? At present, I am doing this in TCC as follows;
and it achieves the same result as SED, but I was hoping for a one-liner.
Yes, I could create a SED.btm, and parse command line arguments to do the same thing, but before I do, thought I would ask.
Thanks from Joe
The Unix utility SED provides the ability to delete a specific line from a file. For example, if I want to delete line 44 from my hosts file, saving the new file with a .bak extension, I can do so with the following SED command;
Code:
sed -i".bak" '44d' hosts
Is there a simple way to do this in TCC? At present, I am doing this in TCC as follows;
Code:
@setlocal
@echo off
head /n43 hosts > hosts.bak
head /n+44 /n%@lines[hosts] hosts >> hosts.bak
endlocal
and it achieves the same result as SED, but I was hoping for a one-liner.
Yes, I could create a SED.btm, and parse command line arguments to do the same thing, but before I do, thought I would ask.
Thanks from Joe