# delete ALL blank lines from a file (same as "grep '.' ")
sed '/^$/d' # method 1
sed '/./!d' # method 2
sed -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P'
# remove all non-consecutive duplicate lines
awk '!x[$0]++' new > newfile
No comments:
Post a Comment