0

What does these commands mean in linux? GBPUSD30MIN and USDJPY30MIN are text files with data having 4 columns and 1000 rows.

cat GBPUSD30MIN | awk '{ print NF }' | uniq -c

awk '{ print $4}' USDJPY30MIN  >USDJPY
  • 2
    The first command prints a list of number of fields for lines in the GBP file... kinda. It prints 2 columns: first the number of consecutive lines, second the field count. That output, I'm guessing, is not particularly useful for you. One way to experiment is to execute the pipline piece by piece: cat file should be obvious; cat file | awk '{print NF}' is a bit more interesting. I suspect you really want cat file | awk '{print $NF}' – glenn jackman Dec 14 '18 at 21:00
  • 1
    the second command copies the 4th column from the 30MIN file – glenn jackman Dec 14 '18 at 21:00
  • 1
    You might want to read stackoverflow.com/tags/awk/info to learn more about awk – glenn jackman Dec 14 '18 at 21:04
  • 1
    Note that cat is unnecessary here. awk allows taking filenames to read as positional parameter, which is what you see in the second command. – Sergiy Kolodyazhnyy Dec 15 '18 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.