remove first line bash code example
Example 1: bash how to remove the first n lines of a file
# Example usage (3 options):
tail -n +43 input_file # Print from the 43rd line on
sed 1,42d input_file # Print from the 43rd line on
sed -i 1,42d input_file # Remove the first 42 lines in place (meaning
# that the file is changed without having to print the output to a
# new file)
Example 2: sed remove first line
tail -n +2 "$FILE" > "$FILE.tmp" && mv "$FILE.tmp" "$FILE"
Example 3: How can I remove the first line of a text file using bash/sed script?
tail -n +2 "$FILE"
Example 4: bash remove first character from line
sed 's/^.\{5\}//' logfile