Guest User

Untitled

a guest
Nov 20th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. find -type f -exec sh -c '[[ $(sed -n $= $0) -eq 2 ]]' {} ; -exec sed -i '1!d' {} +
  2.  
  3. for file in $(ls *.txt)
  4. do
  5. LINENUMB=`wc -l $file | cut -f1 -d' '`
  6. if [[ $LINENUMB == 2 ]]; then
  7. sed -i '$d' $file
  8. fi
  9. done
Add Comment
Please, Sign In to add comment