If you know that you want all of the lines in a given file from n to EOF the following is the sed command:
sed -n '3,$p' some_file.txt
To print out lines 2 – 5 simply modify it to:
sed -n '2,5p' some_file.txt
→ Continue reading “Print Lines in a File From a Specific Line Number Until the End of the File with sed”
Here is a quick one-liner for trimming a specific number of characters from the end of a string under bash:
# Remove the last 5 characters
$ echo "somestringwith12345" | sed "s/.....$//g"
# Remove the last 3 characters
$ echo "somestringwith12345" | sed "s/...$//g"
→ Continue reading “Removing The Last N Character From a String in Bash Script with sed”