sed -i '1d' /filepath/hello.txt
The above command specified to insert the text into the file i.e. modify the file specified after the command.
The '1d' tells sed to delete the first line from the file.
You can also replace text in files e.g:
sed -i 's/text your looking for/text you want to replace it with/' /filepath/hello.txt
The above statement will find the text: "text your looking for" and replace it with "text you want to replace it with" the 's' in the beginning stands for pattern space. The syntax explained:
s/regex
Have fun with it!
No comments:
Post a Comment