Advertisement
cd62131

file generation

Feb 1st, 2018
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.41 KB | None | 0 0
  1. #!/bin/bash
  2. for M in $(seq -w 12); do
  3.   YM="2016${M}"
  4.   mkdir -p ${YM}
  5.   paste \
  6.     "abc_la${M}5.txt" \
  7.     "abc_lo${M}5.txt" \
  8.     "abc_b${M}5.txt" \
  9.     "abc_h${M}5.txt" \
  10.     "abc_q${M}5.txt" \
  11.     "abc_f${M}5.txt" \
  12.     "abc_m${M}5.txt" | \
  13.   awk -v m="${YM}/abc_%02d.txt" '!$4{++d;f=sprintf(m,d)};{print >f}'
  14.   cd ${YM}
  15.   ls abc_[01][0-9].txt | xargs -n1 sed -n '$=' >abc_num.txt
  16.   cd ..
  17. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement