Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to extract the first column from a file named data.txt using cut.
Linux CLI
cut -d',' -f[1] data.txt
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as the field number, which is invalid.
Forgetting to specify the delimiter with
-d.✗ Incorrect
The
-f option specifies which field (column) to extract. Fields start at 1, so to get the first column, use 1.2fill in blank
mediumComplete the code to extract columns 2 and 4 separated by a comma from data.csv.
Linux CLI
cut -d',' -f[1] data.csv
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a range like 2-4 which extracts columns 2, 3, and 4 instead of just 2 and 4.
Swapping the order of columns unintentionally.
✗ Incorrect
Use
-f2,4 to extract the 2nd and 4th columns. The order matters and must match the columns you want.3fill in blank
hardFix the error in the code to extract the third column from file.txt where columns are separated by tabs.
Linux CLI
cut -d[1] -f3 file.txt Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a comma instead of tab as delimiter.
Writing 'tab' as a string instead of the escape sequence.
✗ Incorrect
To specify a tab delimiter, use
$'\t' with -d. A comma or the word 'tab' won't work.4fill in blank
hardComplete the code to extract columns 1 and 3 from records.txt where fields are separated by a colon.
Linux CLI
cut -d: -f[1] records.txt Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using comma as delimiter instead of colon.
Selecting wrong fields like 2,4 instead of 1,3.
✗ Incorrect
Use
-d ':' to set colon as delimiter and -f1,3 to get columns 1 and 3.5fill in blank
hardFill all three blanks to extract columns 2 and 5 from data.tsv where fields are tab-separated.
Linux CLI
cut -d[1] -f[2] data.tsv > [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using comma as delimiter instead of tab.
Forgetting to redirect output to a file.
Selecting wrong columns.
✗ Incorrect
Use
-d $'\t' for tab delimiter, -f2,5 for columns 2 and 5, and redirect output to output.txt.