Linux CLI - Text ProcessingWhich of the following is the correct syntax to print the second field of a space-separated text file using awk?Aawk '{print 2}' filenameBawk 'print $2' filenameCawk '{print $2}' filenameDawk '{print $}' filenameCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand awk field syntaxIn awk, fields are accessed with $ followed by the field number inside braces and quotes.Step 2: Check syntax correctnessawk '{print $2}' filename correctly uses '{print $2}', others miss braces or use wrong syntax.Final Answer:awk '{print $2}' filename -> Option CQuick Check:Correct awk field print syntax = C [OK]Quick Trick: Use single quotes and braces: awk '{print $2}' [OK]Common Mistakes:Omitting braces around print statementUsing print without $ for field numberMissing quotes around awk program
Master "Text Processing" in Linux CLI9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Linux CLI Quizzes Disk and Storage - du (disk usage by directory) - Quiz 13medium Disk and Storage - du (disk usage by directory) - Quiz 11easy Networking Commands - nslookup and dig for DNS - Quiz 2easy Networking Commands - scp and rsync for file transfer - Quiz 15hard Pipes and Redirection - stdin redirection (<) - Quiz 5medium Pipes and Redirection - stdout redirection (>, >>) - Quiz 15hard Searching and Finding - find command basics - Quiz 11easy Searching and Finding - locate for fast filename search - Quiz 2easy Text Processing - sed (stream editor) basics - Quiz 2easy Text Processing - awk basics (field processing) - Quiz 6medium