linux - Script to extract a range of lines from a file in bash -


i have code

week=`date +%v_%d` date=`date +%d%m%y`  #cat file           let tamano=`cat prenum`         file="white_prepago_${date}.txt"         name="base_prepago_paqu_w$week_"         cat whitelist.txt | grep ",0" | sed '/^57/!s/^/57/'  | awk '{fs=","}{print $1}'> $file    # number of lines of file let numlines=$2 #must begin in line in file let lines=$tamano+$2  num=$3   ((i=1; i<=$num; i++))    let d=$4+$i    cat $file | head -$lines | tail -$numlines > base_$d    let lines=$lines+$numlines  done let lines=$lines-$numlines echo $lines>prenum 

i executing code in vm linux , works, , intenting run code in solaris machine not works, in solaris file run not works fine because create number of files write files seim, , in linux create files increment. code have split file in lines write

for example

 bash script.sh 5000 3 0 

this code create 3 files of 5000 lines since base_1 file: base_prepago_paqu_w$week_". not using split because need read number in file prenum or posnum.

in file prenum there number

$cat prenum  5008971 

and code select range of file example if number is: 5008971 , write bash script.sh 5000 3 0 output 3 files line 5008971+5000 5008971+15000.

could please me problem?, or other idea works in solaris?


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -