grep, sed, awk, cut and friends — extract and reshape text and logs.
- Append a line to a logeasy
Append a new line containing exactly "deployed" to /var/tmp/app.log.
- Count distinct wordseasy
Write the number of distinct whitespace words in /opt/data/w.txt to /home/player/n.txt.
- Count the 403seasy
/var/log/access.log has request lines ending in `<status> <bytes>`. Write the number of lines with status 403 to /home/player/answer.txt (just the number).
- Count the lineseasy
Write the number of lines in /etc/passwd into /home/player/answer.txt (just the number).
- Cut a column rangeeasy
From /opt/data/r.csv (comma-sep) write columns 2-3 of every row to /home/player/o.txt.
- Extract unique emailseasy
Pull every email address out of /opt/data/notes.txt; write them unique and sorted, one per line, to /home/player/emails.txt.
- Join Lines With A Commaeasy · in-browser
Write /home/player/oneline.sh: a bash script that collapses the one-name-per-line file /opt/data/names.txt into a single comma-separated line. Use paste with the -s (serial) option and a comma as the delimiter.
(Authored config, graded structurally — the engine isn't run here.)
- Last N lineseasy
Write the last 3 lines of /var/log/seq.log to /home/player/t.txt.
- List login userseasy
Write every username (field 1 of /etc/passwd) sorted ascending, one per line, to /home/player/users.txt.
- Longest lineeasy
Write the single longest line of /opt/data/lines.txt to /home/player/ans.txt.
- Number Every Lineeasy · in-browser
Write /home/player/numbered.sh: a bash script that prints /opt/data/notes.txt with each line prefixed by its 1-based line number and a tab. Use awk's NR (or the nl / cat -n command).
(Authored config, graded structurally — the engine isn't run here.)
- Numeric sorteasy
Sort the numbers in /opt/data/nums.txt ascending numerically, one per line, into /home/player/s.txt.
- Reverse Line Ordereasy · in-browser
Write /home/player/reverse.sh: a bash script that prints the lines of /opt/data/log.txt in reverse order (last line first). Use the tac command (or an equivalent such as tail -r).
(Authored config, graded structurally — the engine isn't run here.)
- Squeeze Repeated Spaceseasy · in-browser
Write /home/player/squeeze.sh: a bash script that reads /opt/data/messy.txt and collapses every run of repeated space characters into a single space, printing the result to stdout. Use tr with the -s (squeeze) option on the space character.
(Authored config, graded structurally — the engine isn't run here.)
- Swap First Two Columnseasy · in-browser
Write /home/player/swap.sh: a bash script that reads the comma-separated file /opt/data/people.csv (rows of last,first,age) and prints each row with the first two fields swapped to first,last,age, keeping the line comma-separated. Use awk with comma as both the input and output field separator.
(Authored config, graded structurally — the engine isn't run here.)
- Unique sorted wordseasy
Write the unique words from /opt/data/words.txt, sorted ascending, one per line, to /home/player/u.txt.
- Average a columnmedium
/opt/data/m.csv has header then label,score. Write the integer average (truncated) of score to /home/player/avg.txt.
- Collapse Spaces To CSVmedium · in-browser
Write /home/player/tocsv.sh: a bash script that turns the whitespace-columned /opt/data/report.txt (fields separated by one or more spaces, exactly 3 fields per line) into a comma-separated file printed to stdout. Use awk with the default whitespace field splitting and a comma output field separator (OFS), rebuilding the record with $1=$1 or printing the explicit field list.
(Authored config, graded structurally — the engine isn't run here.)
- Convert TSV to CSVmedium
Convert the tab-separated /opt/data/in.tsv into comma-separated output at /home/player/out.csv (every tab becomes a comma).
- Dedupe keeping ordermedium
From /opt/data/d.txt remove duplicate lines but keep first-seen order; write to /home/player/o.txt.
- Errors with contextmedium
From /var/log/app.log write every line containing ERROR and the single line immediately after it, to /home/player/ctx.txt.
- Extract Quoted Stringsmedium · in-browser
Write /home/player/quotes.sh: a bash script that extracts the contents of every double-quoted substring from /opt/data/config.txt, printing one value per line WITHOUT the surrounding quotes. Use grep -oE with a pattern that matches a double quote, a run of non-quote characters, and a closing quote, then strip the quotes (e.g. with tr -d or sed).
(Authored config, graded structurally — the engine isn't run here.)
- Extract unique IPsmedium
From /var/log/access.log extract all IPv4 addresses, unique and sorted, to /home/player/ips.txt.
- Filter Rows By Thresholdmedium · in-browser
Write /home/player/over100.sh: a bash script that reads the comma-separated /opt/data/orders.csv (a header line, then rows of id,customer,amount) and prints only the data rows whose amount (the 3rd column) is strictly greater than 100. Skip the header. Use awk with a comma field separator.
(Authored config, graded structurally — the engine isn't run here.)
- Find the busiest clientmedium
From /var/log/access.log (first field is the client IP), write the single IP that appears the most to /home/player/top.txt.
- Lines without a patternmedium
Write every line of /var/log/app.log that does NOT contain DEBUG to /home/player/o.txt.
- Redact IP addressesmedium
Write /home/player/clean.log: a copy of /var/log/app.log with every IPv4 address replaced by the literal text REDACTED.
- Rewrite The CSV Headermedium · in-browser
Write /home/player/relabel.sh: a bash script that reads /opt/data/data.csv and rewrites ONLY the first line (the header) to id,name,email, leaving every data row unchanged. Use awk: on NR==1 print the new header and skip the default action, and pass all other rows through untouched.
(Authored config, graded structurally — the engine isn't run here.)
- Running Total Columnmedium · in-browser
Write /home/player/cumsum.sh: a bash script that reads /opt/data/sales.csv (a header line, then rows of day,amount). Using awk with comma as the field separator, skip the header and print two comma-separated columns per remaining row: the day and a running (cumulative) total of the amount column so far. Set the output field separator (OFS) to a comma.
(Authored config, graded structurally — the engine isn't run here.)
- Strip comments & blanksmedium
From /etc/app/app.conf write only the active lines (drop blank lines and lines starting with #) to /home/player/clean.conf.
- Sum Amounts Per Groupmedium · in-browser
Write /home/player/bycat.sh: a bash script that reads the comma-separated /opt/data/expenses.csv (a header line, then rows of category,amount), and for each distinct category prints 'category total' where total is the summed amount for that category. Skip the header. Use an awk associative array keyed by category, summing in the main block and printing with a for-in loop in an END block.
(Authored config, graded structurally — the engine isn't run here.)
- Sum a numeric columnmedium
/opt/data/nums.csv has a header then rows label,amount. Write the integer sum of the amount column to /home/player/sum.txt.
- Top-5 By Frequencymedium · in-browser
Write /home/player/top5.sh: a bash script that reads /opt/data/words.txt (one token per line), counts how many times each distinct token appears, and prints the 5 most frequent as 'count token' lines, most frequent first. Use the classic sort | uniq -c | sort -rn | head pipeline.
(Authored config, graded structurally — the engine isn't run here.)
- Whole-word replacemedium
In /opt/data/t.txt replace the whole word 'cat' with 'dog' (not substrings like 'category'); write to /home/player/o.txt.
- Count JSON-lines by levelpro
/opt/data/events.jsonl has one JSON object per line. Write the number of objects whose level is error to /home/player/n.txt.
- Count active config keyspro
Write how many non-comment, non-blank lines /etc/ssh/sshd_config has to /home/player/n.txt.
- Extract admin emailspro
/opt/data/users.csv has a header then rows name,email,role. Write to /home/player/admins.txt the emails of users whose role is admin, sorted ascending, one per line, no header.
- Filter+project CSVpro
/opt/data/u.csv: header then name,age,city. Write names of people with age >= 30, sorted, to /home/player/o.txt.
- Find the breachpro
Somewhere in /var/log/audit-sim.log is one line containing a token of the form BREACH-<id>. Write just the <id> into /home/player/finding.txt.
- Join Two CSVs On Keypro · in-browser
Write /home/player/lookup.sh: a bash script that uses awk to enrich /opt/data/orders.csv (rows of order_id,user_id,amount) with names from /opt/data/users.csv (rows of user_id,name). Read users.csv first into an array keyed by user_id (the NR==FNR trick), then for each orders row print order_id,name,amount comma-separated. Both files are comma-separated and have no header.
(Authored config, graded structurally — the engine isn't run here.)
- Join two files on keypro
/opt/data/a.txt and b.txt are sorted `key value` files. Write the inner join `key aval bval` to /home/player/j.txt.
- Sort A Numeric Columnpro · in-browser
Write /home/player/sortcol.sh: a bash script that extracts the 2nd column (the score) from the comma-separated /opt/data/scores.csv (a header line, then rows of name,score) and prints those scores one per line in ascending numeric order. Skip the header. Build a pipeline: drop the header, pull the column with cut (or awk), then sort -n. Do not print the header value.
(Authored config, graded structurally — the engine isn't run here.)
- Status code histogrampro
From /var/log/access.log (status code is the 2nd field) write `<code> <count>` lines sorted ascending by code to /home/player/hist.txt.
- Top-3 frequent wordspro
From /opt/data/words.txt write the 3 most frequent words as `count word` lines (desc by count) to /home/player/top.txt.
- Transpose A Matrixpro · in-browser
Write /home/player/transpose.sh: a bash script that transposes the comma-separated grid in /opt/data/grid.csv (rows become columns and columns become rows). Use awk: store every field into a two-dimensional array indexed by column and row number, track the maximum column count, then in an END block print each column's values across one line, comma-separated. Input and output are comma-separated.
(Authored config, graded structurally — the engine isn't run here.)