Last active
January 17, 2020 13:50
-
-
Save nsahoo/4b2e7923e727ad6c8c66f33be375357e to your computer and use it in GitHub Desktop.
insert_a_string_to_a_file_at_each_line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# insert a string at end of each line in a file, for example: | |
perl -i -pe 's/$/ STRING1 /' test.list | |
# insert a string at beginning of each line in a file, for example: | |
perl -i -pe 's/^/ STRING2 /' test.list | |
# doing both at a time | |
perl -i -pe 's/^/ STRING1 /; s/$/ STRING2 /' test.list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment