Guest User

Untitled

a guest
Feb 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. one two
  2. three
  3. fish hat
  4. cat hop
  5.  
  6. one two three
  7. fish hat cat hop
  8.  
  9. #!/bin/bash
  10. #
  11.  
  12. # input and output files
  13. FILE=$1
  14. FILE2=$2
  15.  
  16. #checks to see if the input file exists
  17. if [ -f $FILE ];then
  18. echo "file $FILE found!"
  19. else
  20. echo "file $FILE does not exist"
  21. exit 1
  22. fi
  23.  
  24. #check to see if output file is empty
  25. if [ -s $FILE2 ]; then
  26. echo "$FILE2 already has data!"
  27. exit 1
  28. fi
  29.  
  30. #Joins every two input lines
  31. while read first; do read second; echo "$firstLine $secondLine";
  32. done < $FILE
  33.  
  34. cat $FILE &> $FILE2
  35.  
  36. cat $file | paste -d ' ' - -
  37.  
  38. cat $file | paste -d ' ' - - > $file2
  39.  
  40. done < $FILE
  41.  
  42. cat $FILE &> $FILE2
  43.  
  44. done <$FILE >$FILE2
Add Comment
Please, Sign In to add comment