Guest User

Untitled

a guest
Feb 19th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. while IFS=$'t' read -r line ; do
  2. some code.. (to get the value of $some_var and $another_var)
  3. echo "$line" | awk -v var1="$some_var" -v var2="$another_var" -F $'t' 'BEGIN {OFS = FS} { $1=$var1 } ; {if($2!="") $2=$var2 }; { print }' >> file.tsv
  4. done < text.tsv
  5.  
  6. File content:
  7. A B D
  8. 1 3 4
  9.  
  10. Intended output
  11. H I D
  12. 6 3 4
  13.  
  14. Output I get:
  15. D
  16. 3 4
  17.  
  18. while IFS=$'t' read -r line ; do
  19. some code.. (to get the value of $some_var and $another_var)
  20. echo "$line"
  21. | awk -v var1="$some_var" -v var2="$another_var" -F $'t'
  22. 'BEGIN {OFS = FS}
  23. { $1=var1 }
  24. {if($2!="") $2=var2 }
  25. { print }' >> file.tsv
  26. done < text.tsv
Add Comment
Please, Sign In to add comment