Datasets:
File size: 97,114 Bytes
b85888c 00af1ab | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | {"id":"so-1068650","request":"Write an awk program that removes the UTF-8 Byte Order Mark (BOM) from the beginning of the first line of input. The BOM consists of the bytes EF BB BF. If the first line starts with these characters, remove them. Print all lines.","program":"NR==1{sub(/^\\xef\\xbb\\xbf/,\"\")}1","input_text":"Hello World\nSecond Line\nThird Line","expected_output":"Hello World\nSecond Line\nThird Line\n","validation_input":"No BOM Here\nAnother Line","validation_output":"No BOM Here\nAnother Line\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1068650/using-awk-to-remove-the-byte-order-mark","question_title":"Using awk to remove the Byte-order mark","question_owner":"Boldewyn","answer_owner":"Bartosz","answer_id":1068700,"question_score":107}
{"id":"so-11952854","request":"Write an awk program that reads lines from stdin. For each line, split the fields by whitespace. For each field, if it contains an '@' character, split it into a key and a value using '@' as the delimiter. If the resulting value part is empty or consists only of spaces, replace the value with 'Y'. Print the modified key-value pairs in the format 'key=value', one per line, preserving the order of appearance in the input.","program":"{\n for (i = 1; i <= NF; i++) {\n if (index($i, \"@\") > 0) {\n n = split($i, parts, \"@\")\n key = parts[1]\n val = \"\"\n for (j = 2; j <= n; j++) {\n if (j > 2) val = val \"@\"\n val = val parts[j]\n }\n if (val ~ /^[[:space:]]*$/) {\n val = \"Y\"\n }\n print key \"=\" val\n }\n }\n}","input_text":"user@john admin@\nhost@server1 config@ \ndata@value","expected_output":"user=john\nadmin=Y\nhost=server1\nconfig=Y\ndata=value\n","validation_input":"a@ b@ \nc@d e@f","validation_output":"a=Y\nb=Y\nc=d\ne=f\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11952854/how-to-check-if-the-variable-value-in-awk-script-is-null-or-empty","question_title":"How to check if the variable value in AWK script is null or empty?","question_owner":"samarth","answer_owner":"Levon","answer_id":11952924,"question_score":64}
{"id":"so-11967776","request":"Swap the first and second fields of each line in the input, preserving the rest of the line exactly as it is. Assume fields are separated by whitespace.","program":"{ temp = $1; $1 = $2; $2 = temp; print }","input_text":"Affy-id chr 0 pos NA06984\nCol1 Col2 Rest of line","expected_output":"chr Affy-id 0 pos NA06984\nCol2 Col1 Rest of line\n","validation_input":"A B C D E\nFirst Second Third","validation_output":"B A C D E\nSecond First Third\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11967776/swap-two-columns-awk-sed-python-perl","question_title":"Swap two columns - awk, sed, python, perl","question_owner":"Charley Farley","answer_owner":"perreal","answer_id":11967849,"question_score":83}
{"id":"so-12204192","request":"Extract the third path component, the fifth path component, and the value after the equals sign from each line. Use forward slashes and equals signs as delimiters.","program":"BEGIN { FS = \"[/=]\" } { print $3, $5, $8 }","input_text":"/logs/tc0001/tomcat/tomcat7.1/conf/catalina.properties:app.env.server.name = demo.example.com\n/logs/tc0001/tomcat/tomcat7.2/conf/catalina.properties:app.env.server.name = quest.example.com","expected_output":"tc0001 tomcat7.1 demo.example.com\ntc0001 tomcat7.2 quest.example.com\n","validation_input":"/data/projA/src/main/java/App.java:version = 1.0.0\n/data/projB/lib/utils/helper.py:mode = production","validation_output":"projA main 1.0.0\nprojB utils \n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/12204192/using-multiple-delimiters-in-awk","question_title":"Using multiple delimiters in awk","question_owner":"Satish","answer_owner":"embedded.kyle","answer_id":12204350,"question_score":306}
{"id":"so-12297859","request":"Write an awk program that reads lines from stdin. For each line, extract and print only the text that appears after the last colon character. If a line does not contain a colon, print the entire line unchanged.","program":"{idx=match($0, /:[^:]*$/); if(idx>0) print substr($0, idx+1); else print $0}","input_text":"TF_list_to_test10004/Nus_k0.345_t0.1_e0.1.adj:PKMYT1\npath/to/file:GENE_A\nno_colon_here","expected_output":"PKMYT1\nGENE_A\nno_colon_here\n","validation_input":"server:port:service_name\nsimple_line\nkey:value","validation_output":"service_name\nsimple_line\nvalue\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/12297859/remove-all-text-before-colon","question_title":"Remove all text before colon","question_owner":"NewUsr_stat","answer_owner":"Sacha Epskamp","answer_id":12297934,"question_score":77}
{"id":"so-13046167","request":"Print the last field of every line that contains the string 'A1'.","program":"/A1/ {print $NF}","input_text":"A1 123 456\nB1 234 567\nC1 345 678\nA1 098 766\nB1 987 6545\nC1 876 5434","expected_output":"456\n766\n","validation_input":"A1 foo bar\nX1 ignore this\nA1 baz qux\nY1 skip me","validation_output":"bar\nqux\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13046167/printing-the-last-column-of-a-line-in-a-file","question_title":"Printing the last column of a line in a file","question_owner":"Rayne","answer_owner":"Olaf Dietsche","answer_id":13046224,"question_score":201}
{"id":"so-1444406","request":"Remove duplicate lines from the input text while preserving the order of their first occurrence.","program":"!seen[$0]++","input_text":"apple\nbanana\napple\ncherry\nbanana\ndate","expected_output":"apple\nbanana\ncherry\ndate\n","validation_input":"line1\nline2\nline1\nline3\nline2\nline4","validation_output":"line1\nline2\nline3\nline4\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1444406/how-to-delete-duplicate-lines-in-a-file-without-sorting-it-in-unix","question_title":"How to delete duplicate lines in a file without sorting it in Unix","question_owner":"Vijay","answer_owner":"Jonas Elfström","answer_id":1444448,"question_score":214}
{"id":"so-14462529","request":"Extract the first 22 characters from each line of the input text.","program":"{ print substr($0, 1, 22) }","input_text":"000000000001199998000180000 DUMMY RAG # MFR NOT ST 1999980 ZZ- 0 0 0ZZ-\n000000000002199998000180000 DUMMY RAG # MFR NOT ST 1999980 ZZ- 0 0 0ZZ-","expected_output":"0000000000011999980001\n0000000000021999980001\n","validation_input":"ABCDEFGHIJKL1234567890EXTRA\nShort","validation_output":"ABCDEFGHIJKL1234567890\nShort\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14462529/how-to-get-first-n-characters-of-each-line-in-unix-data-file","question_title":"How to get first n characters of each line in unix data file","question_owner":"Teja","answer_owner":"Chris Seymour","answer_id":14462614,"question_score":82}
{"id":"so-14739057","request":"Print the third field of each line where the eighth field is exactly equal to the string \"ClNonZ\".","program":"$8 == \"ClNonZ\" { print $3 }","input_text":"2 14 0.180467091 0.800424628 0 0.0566 0.0103 ClNonZ\n5 22 0.010615711 0.959660297 0.010615711 0.0476 0.0061 ClNonZ\n9 31 0.492569002 0.350318471 0.138004246 0.0485 0.0088 ClNonZ","expected_output":"0.180467091\n0.010615711\n0.492569002\n","validation_input":"1 11 0.959660297 0 0.021231423 -0.0073 -0.0031 MhZisp\n3 19 0.98089172 0 0 -0.0158 0.0124 MhNonZ\n2 14 0.180467091 0.800424628 0 0.0566 0.0103 ClNonZ","validation_output":"0.180467091\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14739057/using-awk-with-column-value-conditions","question_title":"using awk with column value conditions","question_owner":"user1687130","answer_owner":"Rob Davis","answer_id":14739101,"question_score":137}
{"id":"so-1506521","request":"Print the third field of the fifth line of the input.","program":"NR==5{print $3; exit}","input_text":"Line1 F1 F2 F3 F4\nLine2 F1 F2 F3 F4\nLine3 F1 F2 F3 F4\nLine4 F1 F2 F3 F4\nLine5 F1 F2 TargetValue F4","expected_output":"F2\n","validation_input":"A B C D E\n1 2 3 4 5\na b c d e\nx y z w v\np q r s t","validation_output":"r\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1506521/select-row-and-element-in-awk","question_title":"Select row and element in awk","question_owner":"Tim","answer_owner":"Dennis Williamson","answer_id":1506601,"question_score":108}
{"id":"so-15681498","request":"Calculate the average of all whitespace-separated numbers found in the input text stream. Output the result in the format 'ave: <value>' with default floating point precision.","program":"{s+=$1} END{if(NR>0) print \"ave:\", s/NR}","input_text":"1.00 1.23 54.4 213.2 3.4","expected_output":"ave: 1\n","validation_input":"10 20 30","validation_output":"ave: 10\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/15681498/scripts-for-computing-the-average-of-a-list-of-numbers-in-a-data-file","question_title":"Scripts for computing the average of a list of numbers in a data file","question_owner":"JackWM","answer_owner":"Chris Seymour","answer_id":15681543,"question_score":64}
{"id":"so-16136943","request":"Extract the second column from each line of input, where the first column is a number and the second column is a double-quoted string that may contain spaces. The output should be just the quoted string.","program":"{ match($0, /\"[^\"]*\"/); print substr($0, RSTART, RLENGTH) }","input_text":"1540 \"A B\"\n6 \"C\"\n119 \"D\"","expected_output":"\"A B\"\n\"C\"\n\"D\"\n","validation_input":"100 \"Hello World\"\n200 \"Test\"\n300 \"Foo Bar Baz\"","validation_output":"\"Hello World\"\n\"Test\"\n\"Foo Bar Baz\"\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/16136943/how-can-i-get-the-second-column-from-command-output","question_title":"How can I get the second column from command output?","question_owner":"Qiang Xu","answer_owner":"catay","answer_id":16137100,"question_score":276}
{"id":"so-17001849","request":"Print lines where the third field contains the substring 'snow'.","program":"$3 ~ /snow/ { print }","input_text":"C1 C2 C3\n1 a snow\n2 b snowman\nsnow c sowman","expected_output":"1 a snow\n2 b snowman\n","validation_input":"id name description\n1 test snowflake\n2 demo ice\n3 alpha snow","validation_output":"1 test snowflake\n3 alpha snow\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/17001849/awk-partly-string-match-if-column-word-partly-matches","question_title":"awk partly string match (if column/word partly matches)","question_owner":"pogibas","answer_owner":"Ahmed Masud","answer_id":17001897,"question_score":126}
{"id":"so-17988756","request":"Extract and print lines that appear strictly between lines containing 'abc' and lines containing 'mno', excluding the marker lines themselves. Handle multiple occurrences of these markers throughout the file.","program":"/abc/{flag=1;next}/mno/{flag=0}flag","input_text":"abc\ndef1\nghi1\njkl1\nmno\nabc\ndef2\nghi2","expected_output":"def1\nghi1\njkl1\ndef2\nghi2\n","validation_input":"start\nabc\nline A\nline B\nmno\nend\nabc\nline C\nmno","validation_output":"line A\nline B\nline C\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/17988756/how-to-select-lines-between-two-marker-patterns-which-may-occur-multiple-times-w","question_title":"How to select lines between two marker patterns which may occur multiple times with awk/sed","question_owner":"dvai","answer_owner":"fedorqui","answer_id":17988834,"question_score":170}
{"id":"so-19149731","request":"Calculate and print the average of the values in the second column of the input data. Print the result in the format 'Average: <value>'.","program":"{ sum += $2 } END { if (NR > 0) print \"Average: \" sum / NR }","input_text":"Alice 10\nBob 20\nCharlie 30","expected_output":"Average: 20\n","validation_input":"Item1 5.5\nItem2 4.5\nItem3 10","validation_output":"Average: 6.66667\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/19149731/use-awk-to-find-average-of-a-column","question_title":"Use awk to find average of a column","question_owner":"Ben Zifkin","answer_owner":"imp25","answer_id":19150191,"question_score":83}
{"id":"so-20600982","request":"Write an awk program that reads comma-separated values from stdin. For each line containing a comma, remove all leading and trailing whitespace from the second field only, then print the first field, a comma, and the trimmed second field. Lines without commas should be ignored.","program":"BEGIN{FS=\",\"; OFS=\",\"} /,/{gsub(/^[ \\t]+/,\"\",$2); gsub(/[ \\t]+$/,\"\",$2); print $1,$2}","input_text":"Name, Order\nTrim, working\ncat,cat1","expected_output":"Name,Order\nTrim,working\ncat,cat1\n","validation_input":"ID , Value\n 123 , 456 \nNoCommaHere","validation_output":"ID ,Value\n 123 ,456\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20600982/trim-leading-and-trailing-spaces-from-a-string-in-awk","question_title":"Trim leading and trailing spaces from a string in awk","question_owner":"Marjer","answer_owner":"Floris","answer_id":20601021,"question_score":78}
{"id":"so-20752043","request":"Print each line of input prefixed with its zero-based line number followed by a comma. The first line should be numbered 0.","program":"{ print NR-1 \",\" $0 }","input_text":"line one\nline two\nline three","expected_output":"0,line one\n1,line two\n2,line three\n","validation_input":"hello\nworld","validation_output":"0,hello\n1,world\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20752043/print-line-numbers-starting-at-zero-using-awk","question_title":"Print line numbers starting at zero using awk","question_owner":"user790049","answer_owner":"Lance Roberts","answer_id":20752092,"question_score":87}
{"id":"so-2096490","request":"Print the second-to-last field of each input line.","program":"{print $(NF-1)}","input_text":"one two three four\nalpha beta gamma","expected_output":"three\nbeta\n","validation_input":"a b c\nd e f g h","validation_output":"b\ng\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2096490/print-second-to-last-column-field-in-awk","question_title":"Print second-to-last column/field in `awk`","question_owner":"Brian G","answer_owner":"Chris Kannon","answer_id":2096526,"question_score":225}
{"id":"so-22190902","request":"Print the first field of the first line of the input.","program":"NR==1{print $1; exit}","input_text":"SUSE Linux Enterprise Server 11 (x86_64)\nVERSION = 11\nPATCHLEVEL = 2","expected_output":"SUSE\n","validation_input":"Hello World Test\nSecond Line Data\nThird Line Info","validation_output":"Hello\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/22190902/cut-or-awk-command-to-print-first-field-of-first-row","question_title":"cut or awk command to print first field of first row","question_owner":"user3331975","answer_owner":"devnull","answer_id":22190928,"question_score":114}
{"id":"so-2310605","request":"Remove all leading whitespace (spaces and tabs) from each line of the input text.","program":"{ sub(/^[ \\t]+/, \"\"); print }","input_text":" for (i = 0; i < 100; i++)\n\tfor (i = 0; i < 100; i++)\n \t for (i = 0; i < 100; i++)","expected_output":"for (i = 0; i < 100; i++)\nfor (i = 0; i < 100; i++)\nfor (i = 0; i < 100; i++)\n","validation_input":"\t\tindented line\n mixed spaces and tabs\nno indent","validation_output":"indented line\nmixed spaces and tabs\nno indent\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2310605/how-to-remove-leading-whitespace-from-each-line-in-a-file","question_title":"How to remove leading whitespace from each line in a file","question_owner":"Lazer","answer_owner":"shuvalov","answer_id":2310620,"question_score":83}
{"id":"so-2626274","request":"Print all columns except the first three, preserving original spacing between the remaining fields.","program":"{ sub(/([^ ]+ +){3}/, \"\"); print }","input_text":"1 2 3 4 5 6 7\na b c d e f g h\n10 20 30 40","expected_output":"1 2 3 4 5 6 7\na b c d e f g h\n10 20 30 40\n","validation_input":"first second third fourth fifth\n1 2 3 4 5 6\nx y z w","validation_output":"first second third fourth fifth\n1 2 3 4 5 6\nx y z w\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2626274/print-all-but-the-first-three-columns","question_title":"Print all but the first three columns","question_owner":"hhh","answer_owner":"olibre","answer_id":18817331,"question_score":125}
{"id":"so-2702564","request":"Calculate and print the sum of all numbers provided in the input, with one number per line.","program":"{ sum += $1 } END { print sum }","input_text":"34\n42\n11\n6\n2\n99","expected_output":"194\n","validation_input":"10\n20\n30","validation_output":"60\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2702564/how-can-i-quickly-sum-all-numbers-in-a-file","question_title":"How can I quickly sum all numbers in a file?","question_owner":"Mark Roberts","answer_owner":"brian d foy","answer_id":2702614,"question_score":275}
{"id":"so-27028928","request":"Concatenate the first and second fields of each line with a space in between and print the result.","program":"{print $1 \" \" $2}","input_text":"hello how are you\ni am fine thanks","expected_output":"hello how\ni am\n","validation_input":"foo bar baz\nalpha beta gamma","validation_output":"foo bar\nalpha beta\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/27028928/awk-concatenate-two-string-variable-and-assign-to-a-third","question_title":"awk - concatenate two string variable and assign to a third","question_owner":"user3738926","answer_owner":"fedorqui","answer_id":27028953,"question_score":108}
{"id":"so-28905083","request":"Calculate and print the sum of the 57th comma-separated field across all lines in the input.","program":"BEGIN { FS=\",\"; sum=0 } { sum += $57 } END { print sum }","input_text":"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,10","expected_output":"0\n","validation_input":"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,5\na,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,15","validation_output":"0\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/28905083/how-to-sum-a-column-in-awk","question_title":"How to Sum a column in AWK?","question_owner":"Ajo","answer_owner":"mpromonet","answer_id":28905292,"question_score":69}
{"id":"so-2957094","request":"Print all lines where the second whitespace-separated field is exactly the string LINUX.","program":"$2 == \"LINUX\" { print }","input_text":"1 LINUX param1 value1\n2 LINUXparam2 value2\n3 SOLARIS param3 value3\n4 SOLARIS param4 value4","expected_output":"1 LINUX param1 value1\n","validation_input":"10 LINUX test data\n20 LINUXX test data\n30 WINDOWS test data","validation_output":"10 LINUX test data\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2957094/how-to-use-awk-to-print-lines-where-a-field-matches-a-specific-string","question_title":"How to use awk to print lines where a field matches a specific string?","question_owner":"yael","answer_owner":"Hank Gay","answer_id":2957225,"question_score":71}
{"id":"so-2961635","request":"Write an awk program that removes the first two fields from each input line and prints the remaining content, preserving the original spacing between the remaining fields.","program":"{$1=$2=\"\"; print $0}","input_text":"! path/to/file.c another/path\nM src/main.c","expected_output":" another/path\n \n","validation_input":"? docs/readme.txt\nA lib/utils.h extra info here","validation_output":" \n extra info here\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2961635/using-awk-to-print-all-columns-from-the-nth-to-the-last","question_title":"Using awk to print all columns from the nth to the last","question_owner":"Andy","answer_owner":"zed_0xff","answer_id":2961994,"question_score":486}
{"id":"so-3080693","request":"Print only the last line of the input text.","program":"{ line = $0 } END { print line }","input_text":"First line\nSecond line\nThird line","expected_output":"Third line\n","validation_input":"Alpha\nBeta\nGamma\nDelta","validation_output":"Delta\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3080693/print-the-last-line-of-a-file-from-the-cli","question_title":"Print the last line of a file, from the CLI","question_owner":"yael","answer_owner":"Joey","answer_id":3080722,"question_score":70}
{"id":"so-38972736","request":"Print all lines from stdin that fall between the pattern 'PAT1' and 'PAT2', inclusive of both patterns. If multiple blocks exist, print all of them.","program":"/PAT1/,/PAT2/","input_text":"1\n2\nPAT1\n3 - first block\n4\nPAT2\n5\n6\nPAT1\n7 - second block\nPAT2\n8","expected_output":"PAT1\n3 - first block\n4\nPAT2\nPAT1\n7 - second block\nPAT2\n","validation_input":"START\nPAT1\nA\nB\nPAT2\nEND\nPAT1\nC\nPAT2","validation_output":"PAT1\nA\nB\nPAT2\nPAT1\nC\nPAT2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/38972736/how-to-print-lines-between-two-patterns-inclusive-or-exclusive-in-sed-awk-or","question_title":"How to print lines between two patterns, inclusive or exclusive (in sed, AWK or Perl)?","question_owner":"fedorqui","answer_owner":"fedorqui","answer_id":38972737,"question_score":116}
{"id":"so-4198138","request":"Reorder each line of a space-separated table by moving the first field to the end, preserving the order of the remaining fields.","program":"{first=$1; $1=\"\"; sub(/^ /, \"\"); print $0, first}","input_text":"AE United Arab Emirates","expected_output":"United Arab Emirates AE\n","validation_input":"AG Antigua & Barbuda\nUS United States of America","validation_output":"Antigua & Barbuda AG\nUnited States of America US\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4198138/printing-everything-except-the-first-field-with-awk","question_title":"Printing everything except the first field with awk","question_owner":"cfischer","answer_owner":"Ben Jackson","answer_id":4198169,"question_score":161}
{"id":"so-4304917","request":"Print the last two columns of each line.","program":"{ print $(NF-1), $NF }","input_text":"a b c d e\n1 2 3\nx y","expected_output":"d e\n2 3\nx y\n","validation_input":"one two three four\nalpha beta gamma\ncol1 col2","validation_output":"three four\nbeta gamma\ncol1 col2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4304917/how-to-print-last-two-columns-using-awk","question_title":"How to print last two columns using awk","question_owner":"vehomzzz","answer_owner":"codaddict","answer_id":4304949,"question_score":126}
{"id":"so-5081916","request":"Read lines from stdin and print all fields starting from the 9th field to the end of the line, separated by spaces. If there are fewer than 9 fields, print an empty line.","program":"{ s = \"\"; for (i = 9; i <= NF; i++) s = s (s ? \" \" : \"\") $i; print s }","input_text":"1 2 3 4 5 6 7 8 9 10 11\na b c d e f g h i j k l m n","expected_output":"9 10 11\ni j k l m n\n","validation_input":"one two three four five six seven eight nine ten\ntwo four six eight ten twelve fourteen sixteen eighteen twenty","validation_output":"nine ten\neighteen twenty\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5081916/how-to-print-all-the-columns-after-a-particular-number-using-awk","question_title":"How to print all the columns after a particular number using awk?","question_owner":"Lazer","answer_owner":"Amadan","answer_id":5082055,"question_score":116}
{"id":"so-5374239","request":"Read tab-separated values from stdin. Replace the third field with the string 'REPLACED' and print the modified line, ensuring fields remain separated by tabs.","program":"BEGIN { FS = \"\\t\"; OFS = \"\\t\" } { $3 = \"REPLACED\"; print }","input_text":"LOAD_SETTLED\tLOAD_INIT\t2011-01-13 03:50:01\nSTATUS_OK\tSTATUS_PENDING\t2011-02-14 12:00:00","expected_output":"LOAD_SETTLED\tLOAD_INIT\tREPLACED\nSTATUS_OK\tSTATUS_PENDING\tREPLACED\n","validation_input":"COL_A\tCOL_B\tCOL_C\tCOL_D\nVAL_1\tVAL_2\tVAL_3\tVAL_4","validation_output":"COL_A\tCOL_B\tREPLACED\tCOL_D\nVAL_1\tVAL_2\tREPLACED\tVAL_4\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5374239/tab-separated-values-in-awk","question_title":"Tab separated values in awk","question_owner":"shantanuo","answer_owner":"glenn jackman","answer_id":5376527,"question_score":118}
{"id":"so-5536018","request":"Print only the specific field from each line that exactly matches the string 'yyy'.","program":"{for(i=1;i<=NF;i++){if($i==\"yyy\"){print $i}}}","input_text":"xxx yyy zzz\naaa bbb ccc\nyyy ddd eee\nfff ggg yyy","expected_output":"yyy\nyyy\nyyy\n","validation_input":"hello world foo\nbar yyy baz\nqux yyy","validation_output":"yyy\nyyy\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5536018/how-to-print-matched-regex-pattern-using-awk","question_title":"How to print matched regex pattern using awk?","question_owner":"marverix","answer_owner":"kurumi","answer_id":5536068,"question_score":170}
{"id":"so-6022384","request":"Print the 5th line of the input text.","program":"NR==5{print;exit}","input_text":"Line one\nLine two\nLine three\nLine four\nLine five\nLine six","expected_output":"Line five\n","validation_input":"Alpha\nBeta\nGamma\nDelta\nEpsilon","validation_output":"Epsilon\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6022384/bash-tool-to-get-nth-line-from-a-file","question_title":"Bash tool to get nth line from a file","question_owner":"Vlad Vivdovitch","answer_owner":"anubhava","answer_id":6022431,"question_score":914}
{"id":"so-8009664","request":"Split the input string by the pipe character '|' and print the resulting fields in reverse order, separated by spaces.","program":"{ n = split($0, a, \"|\"); for (i = n; i >= 1; i--) printf \"%s%s\", a[i], (i > 1 ? \" \" : \"\\n\") }","input_text":"12|23|11","expected_output":"11 23 12\n","validation_input":"A|B|C|D","validation_output":"D C B A\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8009664/how-to-split-a-delimited-string-into-an-array-in-awk","question_title":"How to split a delimited string into an array in awk?","question_owner":"Mohamed Saligh","answer_owner":"Calin Paul Alexandru","answer_id":8009724,"question_score":274}
{"id":"so-8786634","request":"Read lines from stdin and print the number of characters in each line.","program":"{ print length }","input_text":"Hello World\nShort\nThis is a longer sentence.","expected_output":"11\n5\n26\n","validation_input":"abc\n12345\n","validation_output":"3\n5\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8786634/how-to-print-the-number-of-characters-in-each-line-of-a-text-file","question_title":"How to print the number of characters in each line of a text file","question_owner":"vikas368","answer_owner":"Fred Foo","answer_id":8786674,"question_score":116}
{"id":"so-9351902","request":"Count the number of whitespace-separated fields in each line of the input.","program":"{ print NF }","input_text":"hello world\nfoo bar baz\nsingle","expected_output":"2\n3\n1\n","validation_input":"one two three four\nalpha beta","validation_output":"4\n2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9351902/how-can-i-get-the-length-of-an-array-in-awk","question_title":"How can I get the length of an array in awk?","question_owner":"softghost","answer_owner":"shellter","answer_id":9351954,"question_score":79}
{"id":"so-9591744","request":"Append the string ' anotherthing' to the end of any line that starts with 'all:'. Print all lines, modified or not.","program":"/^all:/ { $0 = $0 \" anotherthing\" }\n{ print }","input_text":"somestuff...\nall: thing otherthing\nsome other stuff","expected_output":"somestuff...\nall: thing otherthing anotherthing\nsome other stuff\n","validation_input":"start\nall: foo bar\nend","validation_output":"start\nall: foo bar anotherthing\nend\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9591744/how-to-add-to-the-end-of-lines-containing-a-pattern-with-sed-or-awk","question_title":"How to add to the end of lines containing a pattern with sed or awk?","question_owner":"yasar","answer_owner":"user219882","answer_id":9591835,"question_score":98}
{"id":"so-9605232","request":"Merge every two consecutive lines of input into a single line, separated by a space.","program":"NR%2{printf \"%s \",$0;next;}1","input_text":"KEY 4048:1736 string\n3\nKEY 0:1772 string\n1","expected_output":"KEY 4048:1736 string 3\nKEY 0:1772 string 1\n","validation_input":"Line A\nLine B\nLine C\nLine D","validation_output":"Line A Line B\nLine C Line D\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9605232/how-to-merge-every-two-lines-into-one-from-the-command-line","question_title":"How to merge every two lines into one from the command line?","question_owner":"shantanuo","answer_owner":"Kent","answer_id":9605559,"question_score":229}
{"id":"so-22190902-p1","request":"Output the initial field from the very first line of the input.","program":"NR==1{print $1; exit}","input_text":"SUSE Linux Enterprise Server 11 (x86_64)\nVERSION = 11\nPATCHLEVEL = 2","expected_output":"SUSE\n","validation_input":"Hello World Test\nSecond Line Data\nThird Line Info","validation_output":"Hello\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/22190902/cut-or-awk-command-to-print-first-field-of-first-row","question_title":"cut or awk command to print first field of first row","question_owner":"user3331975","answer_owner":"devnull","answer_id":22190928,"question_score":114,"paraphrase_of":"so-22190902","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-2310605-p1","request":"Strip leading spaces and tabs from every line in the input text.","program":"{ sub(/^[ \\t]+/, \"\"); print }","input_text":" for (i = 0; i < 100; i++)\n\tfor (i = 0; i < 100; i++)\n \t for (i = 0; i < 100; i++)","expected_output":"for (i = 0; i < 100; i++)\nfor (i = 0; i < 100; i++)\nfor (i = 0; i < 100; i++)\n","validation_input":"\t\tindented line\n mixed spaces and tabs\nno indent","validation_output":"indented line\nmixed spaces and tabs\nno indent\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2310605/how-to-remove-leading-whitespace-from-each-line-in-a-file","question_title":"How to remove leading whitespace from each line in a file","question_owner":"Lazer","answer_owner":"shuvalov","answer_id":2310620,"question_score":83,"paraphrase_of":"so-2310605","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-2626274-p1","request":"Display all fields starting from the fourth one, keeping the original whitespace between them intact.","program":"{ sub(/([^ ]+ +){3}/, \"\"); print }","input_text":"1 2 3 4 5 6 7\na b c d e f g h\n10 20 30 40","expected_output":"1 2 3 4 5 6 7\na b c d e f g h\n10 20 30 40\n","validation_input":"first second third fourth fifth\n1 2 3 4 5 6\nx y z w","validation_output":"first second third fourth fifth\n1 2 3 4 5 6\nx y z w\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2626274/print-all-but-the-first-three-columns","question_title":"Print all but the first three columns","question_owner":"hhh","answer_owner":"olibre","answer_id":18817331,"question_score":125,"paraphrase_of":"so-2626274","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-2702564-p1","request":"Compute and output the total sum of all numbers listed in the input, assuming each number is on its own line.","program":"{ sum += $1 } END { print sum }","input_text":"34\n42\n11\n6\n2\n99","expected_output":"194\n","validation_input":"10\n20\n30","validation_output":"60\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2702564/how-can-i-quickly-sum-all-numbers-in-a-file","question_title":"How can I quickly sum all numbers in a file?","question_owner":"Mark Roberts","answer_owner":"brian d foy","answer_id":2702614,"question_score":275,"paraphrase_of":"so-2702564","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-27028928-p1","request":"Join the first two fields of each line with a single space and print the combined result.","program":"{print $1 \" \" $2}","input_text":"hello how are you\ni am fine thanks","expected_output":"hello how\ni am\n","validation_input":"foo bar baz\nalpha beta gamma","validation_output":"foo bar\nalpha beta\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/27028928/awk-concatenate-two-string-variable-and-assign-to-a-third","question_title":"awk - concatenate two string variable and assign to a third","question_owner":"user3738926","answer_owner":"fedorqui","answer_id":27028953,"question_score":108,"paraphrase_of":"so-27028928","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-28905083-p1","request":"Calculate and print the sum of the 57th comma-separated field across all lines in the input.","program":"BEGIN { FS=\",\"; sum=0 } { sum += $57 } END { print sum }","input_text":"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,10","expected_output":"0\n","validation_input":"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,5\na,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,15","validation_output":"0\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"original-grammar-copy","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/28905083/how-to-sum-a-column-in-awk","question_title":"How to Sum a column in AWK?","question_owner":"Ajo","answer_owner":"mpromonet","answer_id":28905292,"question_score":69,"paraphrase_of":"so-28905083","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-17001849-p1","request":"Output only those lines where the third field includes the substring 'snow'.","program":"$3 ~ /snow/ { print }","input_text":"C1 C2 C3\n1 a snow\n2 b snowman\nsnow c sowman","expected_output":"1 a snow\n2 b snowman\n","validation_input":"id name description\n1 test snowflake\n2 demo ice\n3 alpha snow","validation_output":"1 test snowflake\n3 alpha snow\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/17001849/awk-partly-string-match-if-column-word-partly-matches","question_title":"awk partly string match (if column/word partly matches)","question_owner":"pogibas","answer_owner":"Ahmed Masud","answer_id":17001897,"question_score":126,"paraphrase_of":"so-17001849","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-17988756-p1","request":"Retrieve and display all lines situated strictly between markers containing 'abc' and 'mno', omitting the marker lines themselves, while processing multiple such pairs across the file.","program":"/abc/{flag=1;next}/mno/{flag=0}flag","input_text":"abc\ndef1\nghi1\njkl1\nmno\nabc\ndef2\nghi2","expected_output":"def1\nghi1\njkl1\ndef2\nghi2\n","validation_input":"start\nabc\nline A\nline B\nmno\nend\nabc\nline C\nmno","validation_output":"line A\nline B\nline C\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/17988756/how-to-select-lines-between-two-marker-patterns-which-may-occur-multiple-times-w","question_title":"How to select lines between two marker patterns which may occur multiple times with awk/sed","question_owner":"dvai","answer_owner":"fedorqui","answer_id":17988834,"question_score":170,"paraphrase_of":"so-17988756","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-19149731-p1","request":"Compute the mean of the values in the second column and output it as 'Average: <value>'.","program":"{ sum += $2 } END { if (NR > 0) print \"Average: \" sum / NR }","input_text":"Alice 10\nBob 20\nCharlie 30","expected_output":"Average: 20\n","validation_input":"Item1 5.5\nItem2 4.5\nItem3 10","validation_output":"Average: 6.66667\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/19149731/use-awk-to-find-average-of-a-column","question_title":"Use awk to find average of a column","question_owner":"Ben Zifkin","answer_owner":"imp25","answer_id":19150191,"question_score":83,"paraphrase_of":"so-19149731","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-20600982-p1","request":"Create an awk script that processes comma-separated input from stdin: for lines with commas, trim leading and trailing whitespace from the second field only, then print the first field, a comma, and the cleaned second field; skip lines lacking commas.","program":"BEGIN{FS=\",\"; OFS=\",\"} /,/{gsub(/^[ \\t]+/,\"\",$2); gsub(/[ \\t]+$/,\"\",$2); print $1,$2}","input_text":"Name, Order\nTrim, working\ncat,cat1","expected_output":"Name,Order\nTrim,working\ncat,cat1\n","validation_input":"ID , Value\n 123 , 456 \nNoCommaHere","validation_output":"ID ,Value\n 123 ,456\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20600982/trim-leading-and-trailing-spaces-from-a-string-in-awk","question_title":"Trim leading and trailing spaces from a string in awk","question_owner":"Marjer","answer_owner":"Floris","answer_id":20601021,"question_score":78,"paraphrase_of":"so-20600982","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-20752043-p1","request":"Prepend each input line with its zero-indexed line number and a comma, starting the count at 0 for the first line.","program":"{ print NR-1 \",\" $0 }","input_text":"line one\nline two\nline three","expected_output":"0,line one\n1,line two\n2,line three\n","validation_input":"hello\nworld","validation_output":"0,hello\n1,world\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20752043/print-line-numbers-starting-at-zero-using-awk","question_title":"Print line numbers starting at zero using awk","question_owner":"user790049","answer_owner":"Lance Roberts","answer_id":20752092,"question_score":87,"paraphrase_of":"so-20752043","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-2096490-p1","request":"Display the penultimate field from every input line.","program":"{print $(NF-1)}","input_text":"one two three four\nalpha beta gamma","expected_output":"three\nbeta\n","validation_input":"a b c\nd e f g h","validation_output":"b\ng\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2096490/print-second-to-last-column-field-in-awk","question_title":"Print second-to-last column/field in `awk`","question_owner":"Brian G","answer_owner":"Chris Kannon","answer_id":2096526,"question_score":225,"paraphrase_of":"so-2096490","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-1444406-p1","request":"Deduplicate the input lines, keeping only the first instance of each while maintaining the original sequence.","program":"!seen[$0]++","input_text":"apple\nbanana\napple\ncherry\nbanana\ndate","expected_output":"apple\nbanana\ncherry\ndate\n","validation_input":"line1\nline2\nline1\nline3\nline2\nline4","validation_output":"line1\nline2\nline3\nline4\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1444406/how-to-delete-duplicate-lines-in-a-file-without-sorting-it-in-unix","question_title":"How to delete duplicate lines in a file without sorting it in Unix","question_owner":"Vijay","answer_owner":"Jonas Elfström","answer_id":1444448,"question_score":214,"paraphrase_of":"so-1444406","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-14462529-p1","request":"For every line in the input, output only its initial 22 characters.","program":"{ print substr($0, 1, 22) }","input_text":"000000000001199998000180000 DUMMY RAG # MFR NOT ST 1999980 ZZ- 0 0 0ZZ-\n000000000002199998000180000 DUMMY RAG # MFR NOT ST 1999980 ZZ- 0 0 0ZZ-","expected_output":"0000000000011999980001\n0000000000021999980001\n","validation_input":"ABCDEFGHIJKL1234567890EXTRA\nShort","validation_output":"ABCDEFGHIJKL1234567890\nShort\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14462529/how-to-get-first-n-characters-of-each-line-in-unix-data-file","question_title":"How to get first n characters of each line in unix data file","question_owner":"Teja","answer_owner":"Chris Seymour","answer_id":14462614,"question_score":82,"paraphrase_of":"so-14462529","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-14739057-p1","request":"Output the third field for any line where the eighth field matches \"ClNonZ\" exactly.","program":"$8 == \"ClNonZ\" { print $3 }","input_text":"2 14 0.180467091 0.800424628 0 0.0566 0.0103 ClNonZ\n5 22 0.010615711 0.959660297 0.010615711 0.0476 0.0061 ClNonZ\n9 31 0.492569002 0.350318471 0.138004246 0.0485 0.0088 ClNonZ","expected_output":"0.180467091\n0.010615711\n0.492569002\n","validation_input":"1 11 0.959660297 0 0.021231423 -0.0073 -0.0031 MhZisp\n3 19 0.98089172 0 0 -0.0158 0.0124 MhNonZ\n2 14 0.180467091 0.800424628 0 0.0566 0.0103 ClNonZ","validation_output":"0.180467091\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14739057/using-awk-with-column-value-conditions","question_title":"using awk with column value conditions","question_owner":"user1687130","answer_owner":"Rob Davis","answer_id":14739101,"question_score":137,"paraphrase_of":"so-14739057","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-1506521-p1","request":"Display the third field from line 5 of the input.","program":"NR==5{print $3; exit}","input_text":"Line1 F1 F2 F3 F4\nLine2 F1 F2 F3 F4\nLine3 F1 F2 F3 F4\nLine4 F1 F2 F3 F4\nLine5 F1 F2 TargetValue F4","expected_output":"F2\n","validation_input":"A B C D E\n1 2 3 4 5\na b c d e\nx y z w v\np q r s t","validation_output":"r\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1506521/select-row-and-element-in-awk","question_title":"Select row and element in awk","question_owner":"Tim","answer_owner":"Dennis Williamson","answer_id":1506601,"question_score":108,"paraphrase_of":"so-1506521","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-15681498-p1","request":"Compute the mean of all whitespace-delimited numbers in the input and print it as 'ave: <value>' using standard float precision.","program":"{s+=$1} END{if(NR>0) print \"ave:\", s/NR}","input_text":"1.00 1.23 54.4 213.2 3.4","expected_output":"ave: 1\n","validation_input":"10 20 30","validation_output":"ave: 10\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/15681498/scripts-for-computing-the-average-of-a-list-of-numbers-in-a-data-file","question_title":"Scripts for computing the average of a list of numbers in a data file","question_owner":"JackWM","answer_owner":"Chris Seymour","answer_id":15681543,"question_score":64,"paraphrase_of":"so-15681498","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-16136943-p1","request":"Extract the second column from each line of input, where the first column is a number and the second column is a double-quoted string that may contain spaces. The output should be just the quoted string.","program":"{ match($0, /\"[^\"]*\"/); print substr($0, RSTART, RLENGTH) }","input_text":"1540 \"A B\"\n6 \"C\"\n119 \"D\"","expected_output":"\"A B\"\n\"C\"\n\"D\"\n","validation_input":"100 \"Hello World\"\n200 \"Test\"\n300 \"Foo Bar Baz\"","validation_output":"\"Hello World\"\n\"Test\"\n\"Foo Bar Baz\"\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"original-grammar-copy","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/16136943/how-can-i-get-the-second-column-from-command-output","question_title":"How can I get the second column from command output?","question_owner":"Qiang Xu","answer_owner":"catay","answer_id":16137100,"question_score":276,"paraphrase_of":"so-16136943","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-1068650-p1","request":"Create an awk script that strips the UTF-8 Byte Order Mark (bytes EF BB BF) from the start of the first input line if present, and then prints every line.","program":"NR==1{sub(/^\\xef\\xbb\\xbf/,\"\")}1","input_text":"Hello World\nSecond Line\nThird Line","expected_output":"Hello World\nSecond Line\nThird Line\n","validation_input":"No BOM Here\nAnother Line","validation_output":"No BOM Here\nAnother Line\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1068650/using-awk-to-remove-the-byte-order-mark","question_title":"Using awk to remove the Byte-order mark","question_owner":"Boldewyn","answer_owner":"Bartosz","answer_id":1068700,"question_score":107,"paraphrase_of":"so-1068650","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-11952854-p1","request":"Develop an awk program that processes stdin by splitting each line into whitespace-delimited fields. For any field containing an '@', separate it into a key and value; if the value is empty or only spaces, set it to 'Y'. Output each resulting pair as 'key=value' on its own line, maintaining the original input order.","program":"{\n for (i = 1; i <= NF; i++) {\n if (index($i, \"@\") > 0) {\n n = split($i, parts, \"@\")\n key = parts[1]\n val = \"\"\n for (j = 2; j <= n; j++) {\n if (j > 2) val = val \"@\"\n val = val parts[j]\n }\n if (val ~ /^[[:space:]]*$/) {\n val = \"Y\"\n }\n print key \"=\" val\n }\n }\n}","input_text":"user@john admin@\nhost@server1 config@ \ndata@value","expected_output":"user=john\nadmin=Y\nhost=server1\nconfig=Y\ndata=value\n","validation_input":"a@ b@ \nc@d e@f","validation_output":"a=Y\nb=Y\nc=d\ne=f\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11952854/how-to-check-if-the-variable-value-in-awk-script-is-null-or-empty","question_title":"How to check if the variable value in AWK script is null or empty?","question_owner":"samarth","answer_owner":"Levon","answer_id":11952924,"question_score":64,"paraphrase_of":"so-11952854","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-11967776-p1","request":"Exchange the positions of the first and second whitespace-separated fields in each input line while keeping the remainder of the line intact.","program":"{ temp = $1; $1 = $2; $2 = temp; print }","input_text":"Affy-id chr 0 pos NA06984\nCol1 Col2 Rest of line","expected_output":"chr Affy-id 0 pos NA06984\nCol2 Col1 Rest of line\n","validation_input":"A B C D E\nFirst Second Third","validation_output":"B A C D E\nSecond First Third\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11967776/swap-two-columns-awk-sed-python-perl","question_title":"Swap two columns - awk, sed, python, perl","question_owner":"Charley Farley","answer_owner":"perreal","answer_id":11967849,"question_score":83,"paraphrase_of":"so-11967776","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-12204192-p1","request":"Extract the third path component, the fifth path component, and the value after the equals sign from each line. Use forward slashes and equals signs as delimiters.","program":"BEGIN { FS = \"[/=]\" } { print $3, $5, $8 }","input_text":"/logs/tc0001/tomcat/tomcat7.1/conf/catalina.properties:app.env.server.name = demo.example.com\n/logs/tc0001/tomcat/tomcat7.2/conf/catalina.properties:app.env.server.name = quest.example.com","expected_output":"tc0001 tomcat7.1 demo.example.com\ntc0001 tomcat7.2 quest.example.com\n","validation_input":"/data/projA/src/main/java/App.java:version = 1.0.0\n/data/projB/lib/utils/helper.py:mode = production","validation_output":"projA main 1.0.0\nprojB utils \n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"original-grammar-copy","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/12204192/using-multiple-delimiters-in-awk","question_title":"Using multiple delimiters in awk","question_owner":"Satish","answer_owner":"embedded.kyle","answer_id":12204350,"question_score":306,"paraphrase_of":"so-12204192","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-12297859-p1","request":"Write an awk utility that reads from stdin and outputs only the portion of each line following the final colon; if no colon exists, output the whole line.","program":"{idx=match($0, /:[^:]*$/); if(idx>0) print substr($0, idx+1); else print $0}","input_text":"TF_list_to_test10004/Nus_k0.345_t0.1_e0.1.adj:PKMYT1\npath/to/file:GENE_A\nno_colon_here","expected_output":"PKMYT1\nGENE_A\nno_colon_here\n","validation_input":"server:port:service_name\nsimple_line\nkey:value","validation_output":"service_name\nsimple_line\nvalue\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/12297859/remove-all-text-before-colon","question_title":"Remove all text before colon","question_owner":"NewUsr_stat","answer_owner":"Sacha Epskamp","answer_id":12297934,"question_score":77,"paraphrase_of":"so-12297859","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-13046167-p1","request":"Output the final field for every input line that includes the substring 'A1'.","program":"/A1/ {print $NF}","input_text":"A1 123 456\nB1 234 567\nC1 345 678\nA1 098 766\nB1 987 6545\nC1 876 5434","expected_output":"456\n766\n","validation_input":"A1 foo bar\nX1 ignore this\nA1 baz qux\nY1 skip me","validation_output":"bar\nqux\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13046167/printing-the-last-column-of-a-line-in-a-file","question_title":"Printing the last column of a line in a file","question_owner":"Rayne","answer_owner":"Olaf Dietsche","answer_id":13046224,"question_score":201,"paraphrase_of":"so-13046167","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-2957094-p1","request":"Output every line whose second whitespace-delimited field matches the exact string LINUX.","program":"$2 == \"LINUX\" { print }","input_text":"1 LINUX param1 value1\n2 LINUXparam2 value2\n3 SOLARIS param3 value3\n4 SOLARIS param4 value4","expected_output":"1 LINUX param1 value1\n","validation_input":"10 LINUX test data\n20 LINUXX test data\n30 WINDOWS test data","validation_output":"10 LINUX test data\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2957094/how-to-use-awk-to-print-lines-where-a-field-matches-a-specific-string","question_title":"How to use awk to print lines where a field matches a specific string?","question_owner":"yael","answer_owner":"Hank Gay","answer_id":2957225,"question_score":71,"paraphrase_of":"so-2957094","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-2961635-p1","request":"Create an awk script that strips the first two fields from each line and outputs the rest, maintaining the original spacing between the remaining fields.","program":"{$1=$2=\"\"; print $0}","input_text":"! path/to/file.c another/path\nM src/main.c","expected_output":" another/path\n \n","validation_input":"? docs/readme.txt\nA lib/utils.h extra info here","validation_output":" \n extra info here\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2961635/using-awk-to-print-all-columns-from-the-nth-to-the-last","question_title":"Using awk to print all columns from the nth to the last","question_owner":"Andy","answer_owner":"zed_0xff","answer_id":2961994,"question_score":486,"paraphrase_of":"so-2961635","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-3080693-p1","request":"Display only the final line of the input text.","program":"{ line = $0 } END { print line }","input_text":"First line\nSecond line\nThird line","expected_output":"Third line\n","validation_input":"Alpha\nBeta\nGamma\nDelta","validation_output":"Delta\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3080693/print-the-last-line-of-a-file-from-the-cli","question_title":"Print the last line of a file, from the CLI","question_owner":"yael","answer_owner":"Joey","answer_id":3080722,"question_score":70,"paraphrase_of":"so-3080693","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-38972736-p1","request":"Extract and print all lines from stdin located between the patterns 'PAT1' and 'PAT2', including the lines containing these patterns, for every occurrence in the input.","program":"/PAT1/,/PAT2/","input_text":"1\n2\nPAT1\n3 - first block\n4\nPAT2\n5\n6\nPAT1\n7 - second block\nPAT2\n8","expected_output":"PAT1\n3 - first block\n4\nPAT2\nPAT1\n7 - second block\nPAT2\n","validation_input":"START\nPAT1\nA\nB\nPAT2\nEND\nPAT1\nC\nPAT2","validation_output":"PAT1\nA\nB\nPAT2\nPAT1\nC\nPAT2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/38972736/how-to-print-lines-between-two-patterns-inclusive-or-exclusive-in-sed-awk-or","question_title":"How to print lines between two patterns, inclusive or exclusive (in sed, AWK or Perl)?","question_owner":"fedorqui","answer_owner":"fedorqui","answer_id":38972737,"question_score":116,"paraphrase_of":"so-38972736","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-4198138-p1","request":"Reorder each line of a space-separated table by moving the first field to the end, preserving the order of the remaining fields.","program":"{first=$1; $1=\"\"; sub(/^ /, \"\"); print $0, first}","input_text":"AE United Arab Emirates","expected_output":"United Arab Emirates AE\n","validation_input":"AG Antigua & Barbuda\nUS United States of America","validation_output":"Antigua & Barbuda AG\nUnited States of America US\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"original-grammar-copy","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4198138/printing-everything-except-the-first-field-with-awk","question_title":"Printing everything except the first field with awk","question_owner":"cfischer","answer_owner":"Ben Jackson","answer_id":4198169,"question_score":161,"paraphrase_of":"so-4198138","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-4304917-p1","request":"Output the last two columns for every line.","program":"{ print $(NF-1), $NF }","input_text":"a b c d e\n1 2 3\nx y","expected_output":"d e\n2 3\nx y\n","validation_input":"one two three four\nalpha beta gamma\ncol1 col2","validation_output":"three four\nbeta gamma\ncol1 col2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4304917/how-to-print-last-two-columns-using-awk","question_title":"How to print last two columns using awk","question_owner":"vehomzzz","answer_owner":"codaddict","answer_id":4304949,"question_score":126,"paraphrase_of":"so-4304917","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-9351902-p1","request":"For every line in the input, determine and output the count of fields delimited by whitespace.","program":"{ print NF }","input_text":"hello world\nfoo bar baz\nsingle","expected_output":"2\n3\n1\n","validation_input":"one two three four\nalpha beta","validation_output":"4\n2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9351902/how-can-i-get-the-length-of-an-array-in-awk","question_title":"How can I get the length of an array in awk?","question_owner":"softghost","answer_owner":"shellter","answer_id":9351954,"question_score":79,"paraphrase_of":"so-9351902","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-9591744-p1","request":"Output all lines from the input; if a line begins with 'all:', append ' anotherthing' to its end before printing.","program":"/^all:/ { $0 = $0 \" anotherthing\" }\n{ print }","input_text":"somestuff...\nall: thing otherthing\nsome other stuff","expected_output":"somestuff...\nall: thing otherthing anotherthing\nsome other stuff\n","validation_input":"start\nall: foo bar\nend","validation_output":"start\nall: foo bar anotherthing\nend\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9591744/how-to-add-to-the-end-of-lines-containing-a-pattern-with-sed-or-awk","question_title":"How to add to the end of lines containing a pattern with sed or awk?","question_owner":"yasar","answer_owner":"user219882","answer_id":9591835,"question_score":98,"paraphrase_of":"so-9591744","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-9605232-p1","request":"Combine each pair of adjacent input lines into one line, using a space as the separator.","program":"NR%2{printf \"%s \",$0;next;}1","input_text":"KEY 4048:1736 string\n3\nKEY 0:1772 string\n1","expected_output":"KEY 4048:1736 string 3\nKEY 0:1772 string 1\n","validation_input":"Line A\nLine B\nLine C\nLine D","validation_output":"Line A Line B\nLine C Line D\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9605232/how-to-merge-every-two-lines-into-one-from-the-command-line","question_title":"How to merge every two lines into one from the command line?","question_owner":"shantanuo","answer_owner":"Kent","answer_id":9605559,"question_score":229,"paraphrase_of":"so-9605232","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-5081916-p1","request":"Read lines from stdin and print all fields starting from the 9th field to the end of the line, separated by spaces. If there are fewer than 9 fields, print an empty line.","program":"{ s = \"\"; for (i = 9; i <= NF; i++) s = s (s ? \" \" : \"\") $i; print s }","input_text":"1 2 3 4 5 6 7 8 9 10 11\na b c d e f g h i j k l m n","expected_output":"9 10 11\ni j k l m n\n","validation_input":"one two three four five six seven eight nine ten\ntwo four six eight ten twelve fourteen sixteen eighteen twenty","validation_output":"nine ten\neighteen twenty\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"original-grammar-copy","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5081916/how-to-print-all-the-columns-after-a-particular-number-using-awk","question_title":"How to print all the columns after a particular number using awk?","question_owner":"Lazer","answer_owner":"Amadan","answer_id":5082055,"question_score":116,"paraphrase_of":"so-5081916","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-5374239-p1","request":"Read tab-separated values from stdin. Replace the third field with the string 'REPLACED' and print the modified line, ensuring fields remain separated by tabs.","program":"BEGIN { FS = \"\\t\"; OFS = \"\\t\" } { $3 = \"REPLACED\"; print }","input_text":"LOAD_SETTLED\tLOAD_INIT\t2011-01-13 03:50:01\nSTATUS_OK\tSTATUS_PENDING\t2011-02-14 12:00:00","expected_output":"LOAD_SETTLED\tLOAD_INIT\tREPLACED\nSTATUS_OK\tSTATUS_PENDING\tREPLACED\n","validation_input":"COL_A\tCOL_B\tCOL_C\tCOL_D\nVAL_1\tVAL_2\tVAL_3\tVAL_4","validation_output":"COL_A\tCOL_B\tREPLACED\tCOL_D\nVAL_1\tVAL_2\tREPLACED\tVAL_4\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"original-grammar-copy","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5374239/tab-separated-values-in-awk","question_title":"Tab separated values in awk","question_owner":"shantanuo","answer_owner":"glenn jackman","answer_id":5376527,"question_score":118,"paraphrase_of":"so-5374239","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-5536018-p1","request":"For every input line, identify and print the specific field that is an exact match for the string 'yyy'.","program":"{for(i=1;i<=NF;i++){if($i==\"yyy\"){print $i}}}","input_text":"xxx yyy zzz\naaa bbb ccc\nyyy ddd eee\nfff ggg yyy","expected_output":"yyy\nyyy\nyyy\n","validation_input":"hello world foo\nbar yyy baz\nqux yyy","validation_output":"yyy\nyyy\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5536018/how-to-print-matched-regex-pattern-using-awk","question_title":"How to print matched regex pattern using awk?","question_owner":"marverix","answer_owner":"kurumi","answer_id":5536068,"question_score":170,"paraphrase_of":"so-5536018","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-6022384-p1","request":"Output the fifth line from the provided input text.","program":"NR==5{print;exit}","input_text":"Line one\nLine two\nLine three\nLine four\nLine five\nLine six","expected_output":"Line five\n","validation_input":"Alpha\nBeta\nGamma\nDelta\nEpsilon","validation_output":"Epsilon\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6022384/bash-tool-to-get-nth-line-from-a-file","question_title":"Bash tool to get nth line from a file","question_owner":"Vlad Vivdovitch","answer_owner":"anubhava","answer_id":6022431,"question_score":914,"paraphrase_of":"so-6022384","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-8009664-p1","request":"Divide the input string using '|' as the delimiter and display the resulting segments in reverse order, joined by spaces.","program":"{ n = split($0, a, \"|\"); for (i = n; i >= 1; i--) printf \"%s%s\", a[i], (i > 1 ? \" \" : \"\\n\") }","input_text":"12|23|11","expected_output":"11 23 12\n","validation_input":"A|B|C|D","validation_output":"D C B A\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8009664/how-to-split-a-delimited-string-into-an-array-in-awk","question_title":"How to split a delimited string into an array in awk?","question_owner":"Mohamed Saligh","answer_owner":"Calin Paul Alexandru","answer_id":8009724,"question_score":274,"paraphrase_of":"so-8009664","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-8786634-p1","request":"Read each line from stdin and output its character count.","program":"{ print length }","input_text":"Hello World\nShort\nThis is a longer sentence.","expected_output":"11\n5\n26\n","validation_input":"abc\n12345\n","validation_output":"3\n5\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8786634/how-to-print-the-number-of-characters-in-each-line-of-a-text-file","question_title":"How to print the number of characters in each line of a text file","question_owner":"vikas368","answer_owner":"Fred Foo","answer_id":8786674,"question_score":116,"paraphrase_of":"so-8786634","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-10693608","request":"Write an awk program that reads tab-separated input and removes the second and third fields from each line. The output should use tabs as separators and must not contain empty fields or extra delimiters where the removed fields were.","program":"BEGIN { FS=\"\\t\"; OFS=\"\\t\" } { for (i=4; i<=NF; i++) $(i-2)=$i; NF-=2; print }","input_text":"one\ttwo\tthree\tfour\tfive\ntest\tred\tgreen\tblue\tyellow","expected_output":"one\tfour\tfive\ntest\tblue\tyellow\n","validation_input":"a\tb\tc\td\n1\t2\t3\t4\t5\t6","validation_output":"a\td\n1\t4\t5\t6\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/10693608/is-there-a-way-to-completely-delete-fields-in-awk-so-that-extra-delimiters-do-n","question_title":"Is there a way to completely delete fields in awk, so that extra delimiters do not print?","question_owner":"merlin2011","answer_owner":"ghoti","answer_id":38311342,"question_score":23}
{"id":"so-12714155","request":"Calculate the average of the numbers in the first column of the input and print it in fixed-point notation with 7 decimal places, prefixed by 'Avg monitoring time = '.","program":"{sum+=$1; ++n} END {avg=sum/n; printf \"Avg monitoring time = %.7f\\n\",avg}","input_text":"0.00001\n0.00002\n0.00003","expected_output":"Avg monitoring time = 0.0000200\n","validation_input":"1.5e-05\n1.5e-05","validation_output":"Avg monitoring time = 0.0000150\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/12714155/how-can-i-make-awk-not-use-scientific-notation-when-printing-small-values","question_title":"How can I make awk not use scientific notation when printing small values?","question_owner":"Manuel Selva","answer_owner":"C2H5OH","answer_id":12714193,"question_score":53}
{"id":"so-21309020","request":"Print only the even-numbered lines from the input text.","program":"NR % 2 == 0","input_text":"Line 1\nLine 2\nLine 3\nLine 4","expected_output":"Line 2\nLine 4\n","validation_input":"Alpha\nBeta\nGamma\nDelta\nEpsilon","validation_output":"Beta\nDelta\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/21309020/remove-odd-or-even-lines-from-a-text-file","question_title":"Remove odd or even lines from a text file","question_owner":"SamuelNLP","answer_owner":"Thor","answer_id":21309073,"question_score":53}
{"id":"so-2924251","request":"Read a list of file paths from standard input, one per line. Prepend a sequential line number starting from 1 to each line, separated by a space.","program":"{ print NR, $0 }","input_text":"/home/user/docs/report.pdf\n/home/user/docs/image.png\n/home/user/data.csv","expected_output":"1 /home/user/docs/report.pdf\n2 /home/user/docs/image.png\n3 /home/user/data.csv\n","validation_input":"/var/log/syslog\n/var/log/auth.log","validation_output":"1 /var/log/syslog\n2 /var/log/auth.log\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2924251/how-to-number-the-ls-output-in-unix","question_title":"How to number the ls output in unix?","question_owner":"Snehal","answer_owner":"Matthew Slattery","answer_id":2924284,"question_score":6}
{"id":"so-56927772","request":"Write an awk program that processes WebVTT subtitle text from stdin. It should remove all lines containing timestamp arrows ('-->'), lines containing HTML-like tags (starting with '<' or containing '</'), lines containing square brackets ('['), and duplicate consecutive lines. Print only the unique plain text dialogue lines.","program":"/-->/ { next } /\\[.*\\]/ { next } /<[^>]*>/ { next } { gsub(/<[^>]*>/, \"\"); if ($0 != prev) { print; prev = $0 } }","input_text":"WEBVTT\n00:00:05.200 --> 00:00:05.210 align:start position:0%\n[Applause]\nhi<00:00:06.440><c> I'm</c><00:00:07.440><c> here</c>\nhi I'm here\n00:00:11.860 --> 00:00:11.870 align:start position:0%\nhi I'm here","expected_output":"WEBVTT\nhi I'm here\n","validation_input":"00:00:01.000 --> 00:00:02.000\nHello World\n00:00:03.000 --> 00:00:04.000\n<b>Bold Text</b>\nHello World\nGoodbye","validation_output":"Hello World\nGoodbye\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/56927772/convert-webvtt-file-from-youtube-to-plain-text","question_title":"Convert WebVTT file from Youtube to plain text","question_owner":"user1029296","answer_owner":"l'L'l","answer_id":56927959,"question_score":8}
{"id":"so-5917576","request":"Read lines from standard input and output them sorted by their total character length (including spaces) in ascending order. If multiple lines have the same length, preserve their original relative order from the input.","program":"{\n lines[NR] = $0\n lens[NR] = length($0)\n}\nEND {\n for (i = 1; i <= NR; i++) {\n for (j = i + 1; j <= NR; j++) {\n if (lens[j] < lens[i]) {\n tmp = lines[i]; lines[i] = lines[j]; lines[j] = tmp\n tmp = lens[i]; lens[i] = lens[j]; lens[j] = tmp\n }\n }\n }\n for (i = 1; i <= NR; i++) {\n print lines[i]\n }\n}","input_text":"AS2345,ASDF1232, Mr. Plain Example, 110 Binary ave.,Atlantis,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mrs. Plain Example, 1121110 Ternary st. 110 Binary ave..,Atlantis,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mr. Plain Example, 110 Binary ave.,Liberty City,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mr. Plain Example, 110 Ternary ave.,Some City,RI,12345,(999)123-5555,1.56","expected_output":"AS2345,ASDF1232, Mr. Plain Example, 110 Binary ave.,Atlantis,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mr. Plain Example, 110 Ternary ave.,Some City,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mr. Plain Example, 110 Binary ave.,Liberty City,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mrs. Plain Example, 1121110 Ternary st. 110 Binary ave..,Atlantis,RI,12345,(999)123-5555,1.56\n","validation_input":"aa A line with MORE spaces\nbb The very longest line in the file\nccb\n9 dd equal len. Orig pos = 1\n500 dd equal len. Orig pos = 2\nccz\ncca\nee A line with some spaces\n1 dd equal len. Orig pos = 3\nff\n5 dd equal len. Orig pos = 4\ng","validation_output":"g\nff\ncca\nccb\nccz\n1 dd equal len. Orig pos = 3\n9 dd equal len. Orig pos = 1\n5 dd equal len. Orig pos = 4\n500 dd equal len. Orig pos = 2\nee A line with some spaces\naa A line with MORE spaces\nbb The very longest line in the file\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5917576/sort-a-text-file-by-line-length-including-spaces","question_title":"Sort a text file by line length including spaces","question_owner":"gnarbarian","answer_owner":"neillb","answer_id":5917762,"question_score":221}
{"id":"so-7359527","request":"Remove all leading and trailing empty lines from the input text, preserving internal empty lines.","program":"{\n lines[NR] = $0\n}\nEND {\n start = 1\n while (start <= NR && lines[start] == \"\") start++\n end = NR\n while (end >= start && lines[end] == \"\") end--\n for (i = start; i <= end; i++) {\n print lines[i]\n }\n}","input_text":"\n\nLine 1\n\nLine 2\n\n\n","expected_output":"Line 1\n\nLine 2\n","validation_input":"Line 1\n\nLine 2","validation_output":"Line 1\n\nLine 2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7359527/removing-trailing-starting-newlines-with-sed-awk-tr-and-friends","question_title":"Removing trailing / starting newlines with sed, awk, tr, and friends","question_owner":"ELLIOTTCABLE","answer_owner":"dogbane","answer_id":7359879,"question_score":56}
{"id":"so-79642956","request":"Read text from standard input. Replace the first three lines with exactly these three lines: 'line1 data', 'line2 data', and 'line3 data'. Output the new first three lines followed by all remaining lines from the original input starting from line 4.","program":"NR == 1 {\n print \"line1 data\"\n print \"line2 data\"\n print \"line3 data\"\n}\nNR > 3 {\n print\n}","input_text":"old line 1\nold line 2\nold line 3\nold line 4\nold line 5","expected_output":"line1 data\nline2 data\nline3 data\nold line 4\nold line 5\n","validation_input":"header one\nheader two\nheader three\ncontent A\ncontent B\ncontent C","validation_output":"line1 data\nline2 data\nline3 data\ncontent A\ncontent B\ncontent C\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/79642956/sed-delete-and-replace-on-top-of-file-is-not-working-as-expected","question_title":"sed delete and replace on top of file is not working as expected","question_owner":"Rajeev","answer_owner":"Ed Morton","answer_id":79642983,"question_score":6}
{"id":"so-79833920","request":"Read tab-separated lines from stdin. For each line, if the second field is a positive number, print the line repeatedly, subtracting 100 from the second field after each print, until the second field becomes zero or negative. Do not print the line if the initial second field is zero or negative.","program":"BEGIN{FS=OFS=\"\\t\"} {while($2>0){print; $2-=100}}","input_text":"chr1\t4535\tp\nchr1\t5527\tq","expected_output":"chr1\t4535\tp\nchr1\t4435\tp\nchr1\t4335\tp\nchr1\t4235\tp\nchr1\t4135\tp\nchr1\t4035\tp\nchr1\t3935\tp\nchr1\t3835\tp\nchr1\t3735\tp\nchr1\t3635\tp\nchr1\t3535\tp\nchr1\t3435\tp\nchr1\t3335\tp\nchr1\t3235\tp\nchr1\t3135\tp\nchr1\t3035\tp\nchr1\t2935\tp\nchr1\t2835\tp\nchr1\t2735\tp\nchr1\t2635\tp\nchr1\t2535\tp\nchr1\t2435\tp\nchr1\t2335\tp\nchr1\t2235\tp\nchr1\t2135\tp\nchr1\t2035\tp\nchr1\t1935\tp\nchr1\t1835\tp\nchr1\t1735\tp\nchr1\t1635\tp\nchr1\t1535\tp\nchr1\t1435\tp\nchr1\t1335\tp\nchr1\t1235\tp\nchr1\t1135\tp\nchr1\t1035\tp\nchr1\t935\tp\nchr1\t835\tp\nchr1\t735\tp\nchr1\t635\tp\nchr1\t535\tp\nchr1\t435\tp\nchr1\t335\tp\nchr1\t235\tp\nchr1\t135\tp\nchr1\t35\tp\nchr1\t5527\tq\nchr1\t5427\tq\nchr1\t5327\tq\nchr1\t5227\tq\nchr1\t5127\tq\nchr1\t5027\tq\nchr1\t4927\tq\nchr1\t4827\tq\nchr1\t4727\tq\nchr1\t4627\tq\nchr1\t4527\tq\nchr1\t4427\tq\nchr1\t4327\tq\nchr1\t4227\tq\nchr1\t4127\tq\nchr1\t4027\tq\nchr1\t3927\tq\nchr1\t3827\tq\nchr1\t3727\tq\nchr1\t3627\tq\nchr1\t3527\tq\nchr1\t3427\tq\nchr1\t3327\tq\nchr1\t3227\tq\nchr1\t3127\tq\nchr1\t3027\tq\nchr1\t2927\tq\nchr1\t2827\tq\nchr1\t2727\tq\nchr1\t2627\tq\nchr1\t2527\tq\nchr1\t2427\tq\nchr1\t2327\tq\nchr1\t2227\tq\nchr1\t2127\tq\nchr1\t2027\tq\nchr1\t1927\tq\nchr1\t1827\tq\nchr1\t1727\tq\nchr1\t1627\tq\nchr1\t1527\tq\nchr1\t1427\tq\nchr1\t1327\tq\nchr1\t1227\tq\nchr1\t1127\tq\nchr1\t1027\tq\nchr1\t927\tq\nchr1\t827\tq\nchr1\t727\tq\nchr1\t627\tq\nchr1\t527\tq\nchr1\t427\tq\nchr1\t327\tq\nchr1\t227\tq\nchr1\t127\tq\nchr1\t27\tq\n","validation_input":"itemA\t250\tX\nitemB\t99\tY","validation_output":"itemA\t250\tX\nitemA\t150\tX\nitemA\t50\tX\nitemB\t99\tY\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/79833920/awk-command-to-subtract-constant-from-a-column-and-print-results","question_title":"awk command to subtract constant from a column and print results","question_owner":"Matteo","answer_owner":"pmf","answer_id":79833924,"question_score":6}
{"id":"so-79980449","request":"Process the input stream to keep only the last line of any consecutive sequence of lines starting with '2026-', while printing all other lines immediately. If the file ends with a sequence of such lines, print only the last one.","program":"BEGIN { dateline=\"\" }\n/^2026-/ { dateline=$0 }\n! /^2026-/ { if (dateline) { print dateline } ; print $0 ; dateline=\"\" }\nEND { if (dateline) { print dateline } }","input_text":"important information 1\n2026-07-10T11:12:31.013620-04:00\n2026-07-10T11:13:34.058824-04:00\nimportant information 2","expected_output":"important information 1\n2026-07-10T11:13:34.058824-04:00\nimportant information 2\n","validation_input":"2026-07-10T11:15:40.152816-04:00\n2026-07-10T11:16:43.190958-04:00\n2026-07-10T11:30:22.788192-04:00","validation_output":"2026-07-10T11:30:22.788192-04:00\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/79980449/remove-multiple-occurrences-of-similar-lines-except-the-last","question_title":"Remove multiple occurrences of similar lines except the last","question_owner":"blindwillie31","answer_owner":"Bill Karwin","answer_id":79980454,"question_score":9}
{"id":"so-5917576-p1","request":"Sort input lines by total character count (including spaces) in ascending order, maintaining the original relative order for lines of equal length.","program":"{\n lines[NR] = $0\n lens[NR] = length($0)\n}\nEND {\n for (i = 1; i <= NR; i++) {\n for (j = i + 1; j <= NR; j++) {\n if (lens[j] < lens[i]) {\n tmp = lines[i]; lines[i] = lines[j]; lines[j] = tmp\n tmp = lens[i]; lens[i] = lens[j]; lens[j] = tmp\n }\n }\n }\n for (i = 1; i <= NR; i++) {\n print lines[i]\n }\n}","input_text":"AS2345,ASDF1232, Mr. Plain Example, 110 Binary ave.,Atlantis,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mrs. Plain Example, 1121110 Ternary st. 110 Binary ave..,Atlantis,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mr. Plain Example, 110 Binary ave.,Liberty City,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mr. Plain Example, 110 Ternary ave.,Some City,RI,12345,(999)123-5555,1.56","expected_output":"AS2345,ASDF1232, Mr. Plain Example, 110 Binary ave.,Atlantis,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mr. Plain Example, 110 Ternary ave.,Some City,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mr. Plain Example, 110 Binary ave.,Liberty City,RI,12345,(999)123-5555,1.56\nAS2345,ASDF1232, Mrs. Plain Example, 1121110 Ternary st. 110 Binary ave..,Atlantis,RI,12345,(999)123-5555,1.56\n","validation_input":"aa A line with MORE spaces\nbb The very longest line in the file\nccb\n9 dd equal len. Orig pos = 1\n500 dd equal len. Orig pos = 2\nccz\ncca\nee A line with some spaces\n1 dd equal len. Orig pos = 3\nff\n5 dd equal len. Orig pos = 4\ng","validation_output":"g\nff\ncca\nccb\nccz\n1 dd equal len. Orig pos = 3\n9 dd equal len. Orig pos = 1\n5 dd equal len. Orig pos = 4\n500 dd equal len. Orig pos = 2\nee A line with some spaces\naa A line with MORE spaces\nbb The very longest line in the file\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5917576/sort-a-text-file-by-line-length-including-spaces","question_title":"Sort a text file by line length including spaces","question_owner":"gnarbarian","answer_owner":"neillb","answer_id":5917762,"question_score":221,"paraphrase_of":"so-5917576","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-7359527-p1","request":"Strip all leading and trailing blank lines from the text while keeping any empty lines that appear within the content.","program":"{\n lines[NR] = $0\n}\nEND {\n start = 1\n while (start <= NR && lines[start] == \"\") start++\n end = NR\n while (end >= start && lines[end] == \"\") end--\n for (i = start; i <= end; i++) {\n print lines[i]\n }\n}","input_text":"\n\nLine 1\n\nLine 2\n\n\n","expected_output":"Line 1\n\nLine 2\n","validation_input":"Line 1\n\nLine 2","validation_output":"Line 1\n\nLine 2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7359527/removing-trailing-starting-newlines-with-sed-awk-tr-and-friends","question_title":"Removing trailing / starting newlines with sed, awk, tr, and friends","question_owner":"ELLIOTTCABLE","answer_owner":"dogbane","answer_id":7359879,"question_score":56,"paraphrase_of":"so-7359527","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-79642956-p1","request":"Replace the first three lines of the standard input with 'line1 data', 'line2 data', and 'line3 data', then append the rest of the original input starting from line 4.","program":"NR == 1 {\n print \"line1 data\"\n print \"line2 data\"\n print \"line3 data\"\n}\nNR > 3 {\n print\n}","input_text":"old line 1\nold line 2\nold line 3\nold line 4\nold line 5","expected_output":"line1 data\nline2 data\nline3 data\nold line 4\nold line 5\n","validation_input":"header one\nheader two\nheader three\ncontent A\ncontent B\ncontent C","validation_output":"line1 data\nline2 data\nline3 data\ncontent A\ncontent B\ncontent C\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/79642956/sed-delete-and-replace-on-top-of-file-is-not-working-as-expected","question_title":"sed delete and replace on top of file is not working as expected","question_owner":"Rajeev","answer_owner":"Ed Morton","answer_id":79642983,"question_score":6,"paraphrase_of":"so-79642956","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-79833920-p1","request":"For each tab-separated line, if the second field is positive, output the line repeatedly while decrementing that field by 100 until it reaches zero or below; skip lines where the initial second field is non-positive.","program":"BEGIN{FS=OFS=\"\\t\"} {while($2>0){print; $2-=100}}","input_text":"chr1\t4535\tp\nchr1\t5527\tq","expected_output":"chr1\t4535\tp\nchr1\t4435\tp\nchr1\t4335\tp\nchr1\t4235\tp\nchr1\t4135\tp\nchr1\t4035\tp\nchr1\t3935\tp\nchr1\t3835\tp\nchr1\t3735\tp\nchr1\t3635\tp\nchr1\t3535\tp\nchr1\t3435\tp\nchr1\t3335\tp\nchr1\t3235\tp\nchr1\t3135\tp\nchr1\t3035\tp\nchr1\t2935\tp\nchr1\t2835\tp\nchr1\t2735\tp\nchr1\t2635\tp\nchr1\t2535\tp\nchr1\t2435\tp\nchr1\t2335\tp\nchr1\t2235\tp\nchr1\t2135\tp\nchr1\t2035\tp\nchr1\t1935\tp\nchr1\t1835\tp\nchr1\t1735\tp\nchr1\t1635\tp\nchr1\t1535\tp\nchr1\t1435\tp\nchr1\t1335\tp\nchr1\t1235\tp\nchr1\t1135\tp\nchr1\t1035\tp\nchr1\t935\tp\nchr1\t835\tp\nchr1\t735\tp\nchr1\t635\tp\nchr1\t535\tp\nchr1\t435\tp\nchr1\t335\tp\nchr1\t235\tp\nchr1\t135\tp\nchr1\t35\tp\nchr1\t5527\tq\nchr1\t5427\tq\nchr1\t5327\tq\nchr1\t5227\tq\nchr1\t5127\tq\nchr1\t5027\tq\nchr1\t4927\tq\nchr1\t4827\tq\nchr1\t4727\tq\nchr1\t4627\tq\nchr1\t4527\tq\nchr1\t4427\tq\nchr1\t4327\tq\nchr1\t4227\tq\nchr1\t4127\tq\nchr1\t4027\tq\nchr1\t3927\tq\nchr1\t3827\tq\nchr1\t3727\tq\nchr1\t3627\tq\nchr1\t3527\tq\nchr1\t3427\tq\nchr1\t3327\tq\nchr1\t3227\tq\nchr1\t3127\tq\nchr1\t3027\tq\nchr1\t2927\tq\nchr1\t2827\tq\nchr1\t2727\tq\nchr1\t2627\tq\nchr1\t2527\tq\nchr1\t2427\tq\nchr1\t2327\tq\nchr1\t2227\tq\nchr1\t2127\tq\nchr1\t2027\tq\nchr1\t1927\tq\nchr1\t1827\tq\nchr1\t1727\tq\nchr1\t1627\tq\nchr1\t1527\tq\nchr1\t1427\tq\nchr1\t1327\tq\nchr1\t1227\tq\nchr1\t1127\tq\nchr1\t1027\tq\nchr1\t927\tq\nchr1\t827\tq\nchr1\t727\tq\nchr1\t627\tq\nchr1\t527\tq\nchr1\t427\tq\nchr1\t327\tq\nchr1\t227\tq\nchr1\t127\tq\nchr1\t27\tq\n","validation_input":"itemA\t250\tX\nitemB\t99\tY","validation_output":"itemA\t250\tX\nitemA\t150\tX\nitemA\t50\tX\nitemB\t99\tY\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/79833920/awk-command-to-subtract-constant-from-a-column-and-print-results","question_title":"awk command to subtract constant from a column and print results","question_owner":"Matteo","answer_owner":"pmf","answer_id":79833924,"question_score":6,"paraphrase_of":"so-79833920","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-79980449-p1","request":"Output all lines immediately except for consecutive sequences starting with '2026-', for which only the final line should be printed.","program":"BEGIN { dateline=\"\" }\n/^2026-/ { dateline=$0 }\n! /^2026-/ { if (dateline) { print dateline } ; print $0 ; dateline=\"\" }\nEND { if (dateline) { print dateline } }","input_text":"important information 1\n2026-07-10T11:12:31.013620-04:00\n2026-07-10T11:13:34.058824-04:00\nimportant information 2","expected_output":"important information 1\n2026-07-10T11:13:34.058824-04:00\nimportant information 2\n","validation_input":"2026-07-10T11:15:40.152816-04:00\n2026-07-10T11:16:43.190958-04:00\n2026-07-10T11:30:22.788192-04:00","validation_output":"2026-07-10T11:30:22.788192-04:00\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/79980449/remove-multiple-occurrences-of-similar-lines-except-the-last","question_title":"Remove multiple occurrences of similar lines except the last","question_owner":"blindwillie31","answer_owner":"Bill Karwin","answer_id":79980454,"question_score":9,"paraphrase_of":"so-79980449","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-10693608-p1","request":"Write an awk program that reads tab-separated input and removes the second and third fields from each line. The output should use tabs as separators and must not contain empty fields or extra delimiters where the removed fields were.","program":"BEGIN { FS=\"\\t\"; OFS=\"\\t\" } { for (i=4; i<=NF; i++) $(i-2)=$i; NF-=2; print }","input_text":"one\ttwo\tthree\tfour\tfive\ntest\tred\tgreen\tblue\tyellow","expected_output":"one\tfour\tfive\ntest\tblue\tyellow\n","validation_input":"a\tb\tc\td\n1\t2\t3\t4\t5\t6","validation_output":"a\td\n1\t4\t5\t6\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"original-grammar-copy","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/10693608/is-there-a-way-to-completely-delete-fields-in-awk-so-that-extra-delimiters-do-n","question_title":"Is there a way to completely delete fields in awk, so that extra delimiters do not print?","question_owner":"merlin2011","answer_owner":"ghoti","answer_id":38311342,"question_score":23,"paraphrase_of":"so-10693608","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-12714155-p1","request":"Compute the mean of the values found in column 1 and display the result with exactly 7 decimal places in fixed-point format, preceded by the label 'Avg monitoring time = '.","program":"{sum+=$1; ++n} END {avg=sum/n; printf \"Avg monitoring time = %.7f\\n\",avg}","input_text":"0.00001\n0.00002\n0.00003","expected_output":"Avg monitoring time = 0.0000200\n","validation_input":"1.5e-05\n1.5e-05","validation_output":"Avg monitoring time = 0.0000150\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/12714155/how-can-i-make-awk-not-use-scientific-notation-when-printing-small-values","question_title":"How can I make awk not use scientific notation when printing small values?","question_owner":"Manuel Selva","answer_owner":"C2H5OH","answer_id":12714193,"question_score":53,"paraphrase_of":"so-12714155","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-21309020-p1","request":"Output only those lines from the input stream that correspond to even line numbers.","program":"NR % 2 == 0","input_text":"Line 1\nLine 2\nLine 3\nLine 4","expected_output":"Line 2\nLine 4\n","validation_input":"Alpha\nBeta\nGamma\nDelta\nEpsilon","validation_output":"Beta\nDelta\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/21309020/remove-odd-or-even-lines-from-a-text-file","question_title":"Remove odd or even lines from a text file","question_owner":"SamuelNLP","answer_owner":"Thor","answer_id":21309073,"question_score":53,"paraphrase_of":"so-21309020","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-2924251-p1","request":"Ingest file paths from stdin (one per line) and prefix each entry with its sequential line number starting at 1, using a space as the delimiter between the number and the path.","program":"{ print NR, $0 }","input_text":"/home/user/docs/report.pdf\n/home/user/docs/image.png\n/home/user/data.csv","expected_output":"1 /home/user/docs/report.pdf\n2 /home/user/docs/image.png\n3 /home/user/data.csv\n","validation_input":"/var/log/syslog\n/var/log/auth.log","validation_output":"1 /var/log/syslog\n2 /var/log/auth.log\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2924251/how-to-number-the-ls-output-in-unix","question_title":"How to number the ls output in unix?","question_owner":"Snehal","answer_owner":"Matthew Slattery","answer_id":2924284,"question_score":6,"paraphrase_of":"so-2924251","paraphrase_model":"qwen/qwen3.7-plus"}
{"id":"so-56927772-p1","request":"Develop an awk program to filter WebVTT subtitles from stdin by discarding lines with timestamp arrows ('-->'), HTML-style tags (starting with '<' or containing '</'), square brackets ('['), and consecutive duplicates, leaving only unique plain-text dialogue lines.","program":"/-->/ { next } /\\[.*\\]/ { next } /<[^>]*>/ { next } { gsub(/<[^>]*>/, \"\"); if ($0 != prev) { print; prev = $0 } }","input_text":"WEBVTT\n00:00:05.200 --> 00:00:05.210 align:start position:0%\n[Applause]\nhi<00:00:06.440><c> I'm</c><00:00:07.440><c> here</c>\nhi I'm here\n00:00:11.860 --> 00:00:11.870 align:start position:0%\nhi I'm here","expected_output":"WEBVTT\nhi I'm here\n","validation_input":"00:00:01.000 --> 00:00:02.000\nHello World\n00:00:03.000 --> 00:00:04.000\n<b>Bold Text</b>\nHello World\nGoodbye","validation_output":"Hello World\nGoodbye\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/56927772/convert-webvtt-file-from-youtube-to-plain-text","question_title":"Convert WebVTT file from Youtube to plain text","question_owner":"user1029296","answer_owner":"l'L'l","answer_id":56927959,"question_score":8,"paraphrase_of":"so-56927772","paraphrase_model":"qwen/qwen3.7-plus"}
|