If you want lines from 20 to 30 that means you want 11 lines starting from 20 and finishing at 30:
head -n 30 $file | tail -n 11
That is, you firstly get first
30 lines and then you select the last 11=30-20+1 ones.
So in your code would be:
head -n $3 $1 | tail -n $(( $3-$2 + 1 ))
Based on
firstline = $2, lastline = $3, filename = $1head -n $lastline $filename | tail -n $(( $lastline -$firstline + 1 ))
Writing in the bash, it should be the following
#!/bin/bash
(head -n +14 MergedTesting162.csv| tail -n 7) > Person1_Dat2Test.csv
No comments:
Post a Comment