2

I'm having trouble how to through this step for my homework. I insert the command:

tail -n +2 ../data/Pacifici2013_data.csv | cut -d ’;’ -f

and the output comes out saying that cut: option requires an argument -- 'f'

I have no idea how to proceed with this I'm following the book but it doesn't seem to help you out when you encounter this problem. How can I proceed?

  • 4
    If you're really using fancy quotes, i.e. ’;’, then don't. It'll give you no end of troubles and unexpected errors in your code. You should be using straightforward ordinary quotes, i.e. ';'. – roaima Jan 23 '17 at 0:15
3

-f option of cut for sure requires something more.
Option -f is for "field".
You have to define which field you want cut to return.

For example :
-f1 returns first field (separated by -d option => ;)
-f1-10 returns field 1 up to 10.
-f1,5 returns field 1 and 5

See this real examples:

$ echo '1;q;w' |cut -d';' -f
cut: option requires an argument -- 'f'
Try 'cut --help' for more information.
$ echo '1;q;w' |cut -d';' -f2
q
$ echo '1;q;w' |cut -d';' -f2-3
q;w
$ echo '1;q;w' |cut -d';' -f1,3
1;w

PS: Also mind that ../data/Pacifici2013_data.csv refers to a csv file that is not in current directory but in a directory above (higher) than current. For current directory you should use only one dot ./data/<...> or just the filename directly. If file is in a completely different directory use full path.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.