Tag: sed
Add Line Numbers
Use this command to add line numbers to a text file… sed = filename.txt | sed ‘N;s/\n/\t/’ > filename_number.txt
Delete Leading Whitespace Using Sed
Delete leading whitespace (spaces/tabs/etc) from beginning of each line. Same as yesterday’s command – but using sed cat file.txt |…
Sed Regular Expression Range
Print the contents of a file from a given regular expression to another sed -n ‘/start/,/end/ p’ file This will…
Remove Empty Characters at End of Lines
Remove empty characters at the end of each row sed -e ‘s/ *$//’ file.txt
Fish Shell Command History Meme
Use this command if you want to know your command usage stats in the fish shell. grep -v “^\#” “.config/fish/fish_history”|awk…
Remove Empty Lines and Comments
Remove comments and blank lines from example.pl sed ‘/ *#/d; /^$/d’ example.pl
Graphical representation of sub-directories
This command shows a graphical representation of the current sub-directories. ls -R | grep “:” | sed -e ‘s/://’ -e…
Remove Empty Lines
Remove empty lines from a file using sed sed ‘/^$/d’ file.txt Original Article
Recent Comments