sed - grep Trim txt file by certain line number -
i have txt file containing, let's say, 1000 lines. trim obtaining file 100 lines, composed lines 0, 10, 20, 30, etc of original file.
is possible grep or something? thanks
it done awk/sed one-liner:
awk
awk '!(nr%10)' file sed
sed -n '0~10p' file or
sed '0~10!d` file see below example: (sed 1 liner give same output)
print first 10 lines:
kent$ seq 1000|awk '!(nr%10)'|head -10 10 20 30 40 50 60 70 80 90 100 total lines:
kent$ seq 1000|awk '!(nr%10)'|wc -l 100
Comments
Post a Comment