Advertisement
metalx1000

PDF Payroll conversion to column format

Dec 8th, 2015
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.46 KB | None | 0 0
  1. #!/bin/bash
  2. pw="password"
  3. year="2015"
  4.  
  5. for i in *.PDF
  6. do
  7.   #remove password
  8.   qpdf --password=$pw --decrypt $i $i.nopass.pdf
  9.   #convert to ps for formating
  10.   pdf2ps $i.nopass.pdf
  11.  
  12.   #generating text output and formatting into columns
  13.   output+="$(ps2txt "$i.nopass.ps"|\
  14.  grep -e "\/$year" -e 'DIRECT'|\
  15.  tr '\n' ' '|\
  16.  sed "s/** DIRECT DEPOSITS//g")|"
  17.   clear
  18.   echo "$output"|tr '|' '\n'|column -t
  19.  
  20.   rm "$i.nopass.pdf"
  21.   rm "$i.nopass.ps"
  22. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement