Datasets:
Download data/test.jsonl from asterbraid/sedweave-so-data: direct link, hf CLI and curl.
- Browser
- Download file 33.5 kB
-
https://huggingface.co/datasets/asterbraid/sedweave-so-data/resolve/main/data/test.jsonl
- Command line
-
hf download hf://datasets/asterbraid/sedweave-so-data/data/test.jsonl
-
curl -L -o test.jsonl https://huggingface.co/datasets/asterbraid/sedweave-so-data/resolve/main/data/test.jsonl
33.5 kB
| {"id":"so-1032023","request":"Replace all occurrences of the whole word 'bar' with 'no bar' in the input text, ensuring that partial matches like 'embarassment' are not affected.","command":"sed 's/\\bbar\\b/no bar/g'","input_text":"bar embarassment\nbar foo bar\nfoobar","expected_output":"no bar embarassment\nno bar foo no bar\nfoobar","validation_input":"start bar end\nno bar here\nbarbell","validation_output":"start no bar end\nno no bar here\nbarbell","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1032023/sed-whole-word-search-and-replace","question_title":"sed whole word search and replace","question_owner":"ksuralta","answer_owner":"Joakim Lundborg","answer_id":1032039,"question_score":159,"reviewed":true} | |
| {"id":"so-11145270","request":"Replace the entire third line of the input text with the string 'replacement-line'.","command":"sed '3s/.*/replacement-line/'","input_text":"Line one\nLine two\nLine three\nLine four","expected_output":"Line one\nLine two\nreplacement-line\nLine four","validation_input":"Alpha\nBeta\nGamma\nDelta\nEpsilon","validation_output":"Alpha\nBeta\nreplacement-line\nDelta\nEpsilon","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11145270/how-to-replace-an-entire-line-in-a-text-file-by-line-number","question_title":"How to replace an entire line in a text file by line number","question_owner":"user788171","answer_owner":"chepner","answer_id":11145362,"question_score":225,"reviewed":true} | |
| {"id":"so-11245144","request":"Replace any line containing the string 'TEXT_TO_BE_REPLACED' with the text 'This line is removed by the admin.'","command":"sed '/TEXT_TO_BE_REPLACED/c\\This line is removed by the admin.'","input_text":"sometext sometext sometext TEXT_TO_BE_REPLACED sometext sometext sometext\nother line\nanother line with TEXT_TO_BE_REPLACED here","expected_output":"This line is removed by the admin.\nother line\nThis line is removed by the admin.\n","validation_input":"line one\nTEXT_TO_BE_REPLACED\nline three","validation_output":"line one\nThis line is removed by the admin.\nline three","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11245144/replace-whole-line-containing-a-string-using-sed","question_title":"Replace whole line containing a string using Sed","question_owner":"Rahul","answer_owner":"Todd A. Jacobs","answer_id":11245501,"question_score":472,"reviewed":true} | |
| {"id":"so-11469989","request":"Remove the first 4 characters from each line of input.","command":"sed 's/^....//'","input_text":"pid: 1234\nname: test","expected_output":" 1234\n: test","validation_input":"code: ABCD\nid: 9999","validation_output":": ABCD\n9999","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11469989/how-can-i-strip-first-x-characters-from-string-using-sed","question_title":"How can I strip first X characters from string using sed?","question_owner":"Kokesh","answer_owner":"Arnaud F.","answer_id":11470076,"question_score":174,"reviewed":true} | |
| {"id":"so-11568859","request":"Extract the first sequence of digits followed by 'G' and more digits from each line, printing only the match.","command":"sed -n 's/^[^0-9]*\\([0-9][0-9]*G[0-9][0-9]*\\).*/\\1/p'","input_text":"This is 02G05 a test string 20-Jul-2012","expected_output":"02G05","validation_input":"No match here\nCode 123G456 found\n9G1 end","validation_output":"123G456\n9G1","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11568859/how-to-extract-text-from-a-string-using-sed","question_title":"How to extract text from a string using sed?","question_owner":"RanRag","answer_owner":"tripleee","answer_id":11568930,"question_score":130,"reviewed":true} | |
| {"id":"so-13055889","request":"Replace all commas with a comma surrounded by single quotes in the input text.","command":"sed \"s/,/','/g\"","input_text":"A,B,C","expected_output":"A','B','C","validation_input":"X,Y,Z\n1,2","validation_output":"X','Y','Z\n1','2","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13055889/sed-with-literal-string-not-input-file","question_title":"sed with literal string--not input file","question_owner":"amphibient","answer_owner":"Gilles Quénot","answer_id":13055913,"question_score":135,"reviewed":true} | |
| {"id":"so-13242469","request":"Extract the text between the words 'Here' and 'String' on a single line, removing the words themselves.","command":"sed 's/^.*Here\\(.*\\)String.*$/\\1/'","input_text":"Here is a String","expected_output":" is a ","validation_input":"Here we go String now","validation_output":" we go ","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13242469/how-to-use-sed-grep-to-extract-text-between-two-words","question_title":"How to use sed/grep to extract text between two words?","question_owner":"user1190650","answer_owner":"Brian Campbell","answer_id":13242517,"question_score":228,"reviewed":true} | |
| {"id":"so-1429556","request":"Print only the second line of the input stream.","command":"sed -n '2p'","input_text":"first line\nsecond line\nthird line","expected_output":"second line\n","validation_input":"alpha\nbeta\ngamma\ndelta","validation_output":"beta\n","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1429556/command-to-get-nth-line-of-stdout","question_title":"Command to get nth line of STDOUT","question_owner":"Alana Storm","answer_owner":"Jonathan Leffler","answer_id":1429628,"question_score":277,"reviewed":true} | |
| {"id":"so-14671293","request":"Remove all sequences of digits from the input text using a POSIX-compatible character class.","command":"sed 's/[[:digit:]]\\+//g'","input_text":"abc123def456\n789xyz","expected_output":"abcdef\nxyz","validation_input":"no digits here\n1a2b3c","validation_output":"no digits here\nabc","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14671293/why-doesnt-d-work-in-regular-expressions-in-sed","question_title":"Why doesn't `\\d` work in regular expressions in sed?","question_owner":"user2036880","answer_owner":"Kamil","answer_id":14671415,"question_score":105,"reviewed":true} | |
| {"id":"so-148451","request":"Replace only the first occurrence of the string 'foo' with 'bar' in the input stream.","command":"sed '0,/foo/s//bar/'","input_text":"foo baz\nfoo qux\nfoo end","expected_output":"bar baz\nfoo qux\nfoo end","validation_input":"no match here\nfoo match here\nfoo another","validation_output":"no match here\nbar match here\nfoo another","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/148451/how-to-use-sed-to-replace-only-the-first-occurrence-in-a-file","question_title":"How to use sed to replace only the first occurrence in a file?","question_owner":"David Dibben","answer_owner":"Ben Hoffstein","answer_id":148473,"question_score":346,"reviewed":true} | |
| {"id":"so-15559359","request":"Insert the line 'CLIENTSCRIPT2=\"hello\"' after the first line that matches 'CLIENTSCRIPT=\"foo\"'.","command":"sed '/CLIENTSCRIPT=\"foo\"/a\\\nCLIENTSCRIPT2=\"hello\"'","input_text":"CLIENTSCRIPT=\"foo\"\nCLIENTFILE=\"bar\"","expected_output":"CLIENTSCRIPT=\"foo\"\nCLIENTSCRIPT2=\"hello\"\nCLIENTFILE=\"bar\"","validation_input":"line1\nCLIENTSCRIPT=\"foo\"\nline3","validation_output":"line1\nCLIENTSCRIPT=\"foo\"\nCLIENTSCRIPT2=\"hello\"\nline3","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/15559359/insert-line-after-match-using-sed","question_title":"Insert line after match using sed","question_owner":"user2150250","answer_owner":"Gilles Quénot","answer_id":15559399,"question_score":371,"reviewed":true} | |
| {"id":"so-15849119","request":"Replace all occurrences of the word 'dog' with 'log' in each line of the input.","command":"sed -e 's/dog/log/g'","input_text":"dog dog dos","expected_output":"log log dos","validation_input":"a dog b dog c","validation_output":"a log b log c","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/15849119/why-does-sed-not-replace-all-occurrences","question_title":"Why does sed not replace all occurrences?","question_owner":"Nishant George Agrwal","answer_owner":"Bruno Reis","answer_id":15849152,"question_score":188,"reviewed":true} | |
| {"id":"so-16414410","request":"Remove all lines that are empty or contain only whitespace characters from the input text.","command":"sed '/^[[:space:]]*$/d'","input_text":"xxxxxx\n \n\nyyyyyy\n\t\nzzzzzz","expected_output":"xxxxxx\nyyyyyy\nzzzzzz","validation_input":"hello\n \nworld\n\nfoo","validation_output":"hello\nworld\nfoo","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/16414410/delete-empty-lines-using-sed","question_title":"Delete empty lines using sed","question_owner":"jonas","answer_owner":"Kent","answer_id":16414489,"question_score":530,"reviewed":true} | |
| {"id":"so-1665549","request":"Extract the filename from lines matching the pattern '[wrote filename.class]' and suppress all other lines.","command":"sed -n 's/^\\[wrote \\(.*\\.class\\)\\]$/\\1/p'","input_text":"[wrote some-class-name.class]","expected_output":"some-class-name.class","validation_input":"[wrote Main.class]\ncompiling...\n[wrote Utils.class]","validation_output":"Main.class\nUtils.class","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1665549/have-sed-ignore-non-matching-lines","question_title":"Have sed ignore non-matching lines","question_owner":"Paggas","answer_owner":"liori","answer_id":1665662,"question_score":138,"reviewed":true} | |
| {"id":"so-1706431","request":"Replace all spaces in the input with underscores.","command":"sed 's/ /_/g'","input_text":"This is just a test\nWindows XP","expected_output":"This_is_just_a_test\nWindows_XP","validation_input":"Hello World Foo Bar\nMy File Name.txt","validation_output":"Hello_World_Foo_Bar\nMy_File_Name.txt","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1706431/the-easiest-way-to-replace-white-spaces-with-underscores-in-bash","question_title":"The easiest way to replace white spaces with (underscores) _ in bash","question_owner":"flazzarini","answer_owner":"ghostdog74","answer_id":1706459,"question_score":107,"reviewed":true} | |
| {"id":"so-17511639","request":"Extract and print only the last integer and floating-point number (separated by whitespace) from each line, ignoring preceding text.","command":"sed -n 's/^.*[^0-9]\\([0-9][0-9]*\\)[ \\t]\\([0-9][0-9]*\\.[0-9][0-9]*\\)[ \\t]*$/\\1 \\2/p'","input_text":"foo bar <foo> bla 1 2 3.4\nno match here\nvalues 10 20.5","expected_output":"2 3.4\n10 20.5","validation_input":"test 5 6.7\nabc 123 456.789\nnothing","validation_output":"5 6.7\n123 456.789\n","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/17511639/sed-print-only-matching-group","question_title":"sed: print only matching group","question_owner":"mort","answer_owner":"iruvar","answer_id":17511700,"question_score":205,"reviewed":true} | |
| {"id":"so-18439528","request":"Insert the line ' hello world' (with three leading spaces) before the second line of the input text.","command":"sed '2i\\ hello world'","input_text":"hello\nworld","expected_output":"hello\n hello world\nworld","validation_input":"line1\nline2\nline3","validation_output":"line1\n hello world\nline2\nline3","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/18439528/sed-insert-line-with-leading-spaces-to-a-specific-line","question_title":"sed insert line with leading spaces to a specific line","question_owner":"Ggdw","answer_owner":"Atropo","answer_id":18439749,"question_score":120,"reviewed":true} | |
| {"id":"so-20348097","request":"Remove the colon and everything after it from each line of input.","command":"sed 's/:.*//'","input_text":"/some/random/file.csv:some string\n/some/random/file2.csv:some string2","expected_output":"/some/random/file.csv\n/some/random/file2.csv","validation_input":"path/to/data.txt:value here\nanother/path.log:more data","validation_output":"path/to/data.txt\nanother/path.log","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20348097/bash-extract-string-before-a-colon","question_title":"bash, extract string before a colon","question_owner":"user788171","answer_owner":"ray","answer_id":20348145,"question_score":111,"reviewed":true} | |
| {"id":"so-2112469","request":"Delete lines 5 through 10 and line 12 from the input text.","command":"sed -e '5,10d;12d'","input_text":"Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nLine 8","expected_output":"Line 1\nLine 2\nLine 3\nLine 4\n","validation_input":"A\nB\nC\nD\nE\nF\nG\nH\nI\nJ\nK\nL\nM","validation_output":"A\nB\nC\nD\nK\nM","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2112469/delete-specific-line-numbers-from-a-text-file-using-sed","question_title":"Delete specific line number(s) from a text file using sed?","question_owner":"Justin Ethier","answer_owner":"Brian Campbell","answer_id":2112496,"question_score":367,"reviewed":true} | |
| {"id":"so-24509214","request":"Replace the string 'ones' with 'one's' in the input text using sed.","command":"sed \"s/ones/one's/g\"","input_text":"ones thing","expected_output":"one's thing","validation_input":"ones and ones again","validation_output":"one's and one's again","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/24509214/how-to-escape-single-quote-in-sed","question_title":"How to escape single quote in sed?","question_owner":"Thomas Bratt","answer_owner":"Kent","answer_id":24509931,"question_score":148,"reviewed":true} | |
| {"id":"so-2610115","request":"Insert a literal tab character at the beginning of every line in the input.","command":"sed 's/^/\t/'","input_text":"hello\nworld","expected_output":"\thello\n\tworld","validation_input":"foo\nbar\nbaz","validation_output":"\tfoo\n\tbar\n\tbaz","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2610115/why-is-sed-not-recognizing-t-as-a-tab","question_title":"Why is sed not recognizing \\t as a tab?","question_owner":"sixtyfootersdude","answer_owner":"Mark Byers","answer_id":2610121,"question_score":132,"reviewed":true} | |
| {"id":"so-26568952","request":"Swap all occurrences of 'ab' with 'bc' and 'bc' with 'ab' simultaneously in the input stream, assuming '~' does not appear in the text.","command":"sed 's/ab/~~/g; s/bc/ab/g; s/~~/bc/g'","input_text":"abbc","expected_output":"bcab","validation_input":"abc ab bc","validation_output":"bcc bc ab","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/26568952/how-to-swap-text-based-on-patterns-at-once-with-sed","question_title":"How to swap text based on patterns at once with sed?","question_owner":"DaniloNC","answer_owner":"ooga","answer_id":26568996,"question_score":344,"reviewed":true} | |
| {"id":"so-2777579","request":"Extract only the sequences of digits from each line, separated by a space. If a line has multiple digit sequences, print them all on one line separated by spaces. If no digits, print nothing for that line.","command":"sed -n 's/[^0-9][^0-9]*/ /g; s/^ *//; s/ *$//; /[0-9]/p'","input_text":"This is a sample 123 text and some 987 numbers\nno numbers here\nabc 42 def","expected_output":"123 987\n42","validation_input":"start 10 middle 20 end\njust text\n555","validation_output":"10 20\n555","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2777579/how-can-i-output-only-captured-groups-with-sed","question_title":"How can I output only captured groups with sed?","question_owner":"Pablo","answer_owner":"Dennis Williamson","answer_id":2778096,"question_score":426,"reviewed":true} | |
| {"id":"so-2869669","request":"Append the string 'string after each line' to the end of every line in the input.","command":"sed -e 's/$/string after each line/'","input_text":"Line one\nLine two\nLine three","expected_output":"Line onestring after each line\nLine twostring after each line\nLine threestring after each line","validation_input":"Hello World\nFoo Bar","validation_output":"Hello Worldstring after each line\nFoo Barstring after each line","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2869669/in-bash-how-do-i-add-a-string-after-each-line-in-a-file","question_title":"In Bash, how do I add a string after each line in a file?","question_owner":"Jason Volkoz","answer_owner":"Tom DeGisi","answer_id":2869736,"question_score":170,"reviewed":true} | |
| {"id":"so-3134791","request":"Remove all newline characters from the input text to join all lines into a single continuous string.","command":"sed ':a;N;$!ba;s/\\n//g'","input_text":"22791\n;\n14336\n;\n22821\n;","expected_output":"22791;14336;22821;","validation_input":"A\nB\nC\n","validation_output":"ABC\n","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3134791/how-do-i-remove-newlines-from-a-text-file","question_title":"How do I remove newlines from a text file?","question_owner":"Alucard","answer_owner":"Tyler McHenry","answer_id":3134827,"question_score":213,"reviewed":true} | |
| {"id":"so-38672680","request":"Join all lines into a single line, replacing newlines with the literal characters backslash and n.","command":"sed ':a;N;$!ba;s/\\n/\\\\n/g'","input_text":"Line one\nLine two\nLine three","expected_output":"Line one\\nLine two\\nLine three","validation_input":"First\nSecond","validation_output":"First\\nSecond","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/38672680/replace-newlines-with-literal-n","question_title":"Replace newlines with literal \\n","question_owner":"Parze","answer_owner":"anubhava","answer_id":38672741,"question_score":106,"reviewed":true} | |
| {"id":"so-38972736","request":"Print all lines from the first occurrence of 'PAT1' to the next occurrence of 'PAT2', inclusive of both pattern lines.","command":"sed -n '/PAT1/,/PAT2/p'","input_text":"1\n2\nPAT1\n3\n4\nPAT2\n5","expected_output":"PAT1\n3\n4\nPAT2\n","validation_input":"start\nPAT1\nmiddle\nend\nPAT2\nfinish","validation_output":"PAT1\nmiddle\nend\nPAT2\n","family":"real-stackoverflow","difficulty":3,"split":"test","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,"reviewed":true} | |
| {"id":"so-4569825","request":"Convert all uppercase letters in the input text to lowercase.","command":"sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'","input_text":"Hello World\nTHIS IS A TEST\nMixed Case Text","expected_output":"hello world\nthis is a test\nmixed case text","validation_input":"ABCdef\nXYZ123\nNo Change here","validation_output":"abcdef\nxyz123\nno change here","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4569825/sed-one-liner-to-convert-all-uppercase-to-lowercase","question_title":"sed one-liner to convert all uppercase to lowercase?","question_owner":"magnetar","answer_owner":"magnetar","answer_id":4581564,"question_score":213,"reviewed":true} | |
| {"id":"so-5080988","request":"Extract the value inside double quotes that immediately follows name= on each line.","command":"sed -n 's/.*name=\"\\([^\"]*\\)\".*/\\1/p'","input_text":"<table name=\"content_analyzer\" primary-key=\"id\">\n<type=\"global\" />\n</table>","expected_output":"content_analyzer\n","validation_input":"<tag name=\"test_value\" attr=\"val\">","validation_output":"test_value","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5080988/how-to-extract-string-following-a-pattern-with-grep-regex-or-perl","question_title":"How to extract string following a pattern with grep, regex or perl","question_owner":"wrangler","answer_owner":"sidyll","answer_id":5081519,"question_score":122,"reviewed":true} | |
| {"id":"so-5227295","request":"Delete the line matching 'The second line' and all subsequent lines from the input text.","command":"sed '/The second line/,$d'","input_text":"The first line\nThe second line\nThe third line\nThe fourth line","expected_output":"The first line\n","validation_input":"Line A\nLine B\nThe second line\nLine C","validation_output":"Line A\nLine B\n","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5227295/how-do-i-delete-all-lines-in-a-file-starting-from-after-a-matching-line","question_title":"How do I delete all lines in a file starting from after a matching line?","question_owner":"DocWiki","answer_owner":"Dennis Williamson","answer_id":5227429,"question_score":126,"reviewed":true} | |
| {"id":"so-538664","request":"Print only the first 12 characters of each line from the input text.","command":"sed -e 's/^\\(.\\{12\\}\\).*/\\1/'","input_text":"Hello World This Is A Test\nShort\nThis is a longer line that exceeds twelve characters","expected_output":"Hello World \nShort\nThis is a lo","validation_input":"123456789012345\n123456789012\nabcdefghijklmnop","validation_output":"123456789012\n123456789012\nabcdefghijkl","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/538664/using-sed-how-do-you-print-the-first-n-characters-of-a-line","question_title":"Using sed, how do you print the first 'N' characters of a line?","question_owner":"Berlin Brown","answer_owner":"Paul Tomblin","answer_id":538676,"question_score":153,"reviewed":true} | |
| {"id":"so-5410757","request":"Delete all lines containing the string 'error' from the input text.","command":"sed '/error/d'","input_text":"line one\nerror found here\nline three\nanother error line\nfinal line","expected_output":"line one\nline three\nfinal line","validation_input":"no errors here\nthis is clean\nerror in middle\nclean again","validation_output":"this is clean\nclean again","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5410757/how-can-i-delete-all-lines-that-contain-a-specific-string-from-a-text-file","question_title":"How can I delete all lines that contain a specific string from a text file?","question_owner":"A Clockwork Orange","answer_owner":"SiegeX","answer_id":5410784,"question_score":2423,"reviewed":true} | |
| {"id":"so-6022384","request":"Print only the 3rd line of the input text.","command":"sed '3q;d'","input_text":"first line\nsecond line\nthird line\nfourth line\nfifth line","expected_output":"third line\n","validation_input":"alpha\nbeta\ngamma\ndelta","validation_output":"gamma\n","family":"real-stackoverflow","difficulty":3,"split":"test","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,"reviewed":true} | |
| {"id":"so-6287755","request":"Delete all lines strictly between a line starting with # and a line starting with $, keeping the boundary lines.","command":"sed '/^#/,/^\\$/{/^#/!{/^\\$/!d}}'","input_text":"# ID 1\nblah blah\nblah blah\n$ description 1\nblah blah","expected_output":"# ID 1\n$ description 1\nblah blah","validation_input":"# Start\nremove this\nand this\n$ End\nkeep this","validation_output":"# Start\n$ End\nkeep this","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6287755/using-sed-to-delete-all-lines-between-two-matching-patterns","question_title":"Using sed to delete all lines between two matching patterns","question_owner":"Ken","answer_owner":"anubhava","answer_id":6287940,"question_score":120,"reviewed":true} | |
| {"id":"so-723157","request":"Insert a newline before every occurrence of a phone number pattern like (012)345-6789 in the input text.","command":"sed 's/(\\([0-9]\\{3\\}\\))[0-9]\\{3\\}-[0-9]\\{4\\}/\\n&/g'","input_text":"some text (012)345-6789","expected_output":"some text \n(012)345-6789","validation_input":"call (123)456-7890 or (987)654-3210 now","validation_output":"call \n(123)456-7890 or \n(987)654-3210 now","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/723157/how-to-insert-a-newline-in-front-of-a-pattern","question_title":"How to insert a newline in front of a pattern?","question_owner":"Dennis","answer_owner":"Dennis","answer_id":723247,"question_score":146,"reviewed":true} | |
| {"id":"so-7451423","request":"Print only the line immediately following any line that contains the string 'blah'. Do not print the matching line itself.","command":"sed -n '/blah/{n;p;}'","input_text":"header\nblah found\nnext line content\nfooter","expected_output":"next line content\n","validation_input":"no match here\nblah trigger\nresult line\nanother blah\nsecond result\nend","validation_output":"result line\nsecond result\n","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7451423/how-to-show-only-next-line-after-the-matched-one","question_title":"How to show only next line after the matched one?","question_owner":"facha","answer_owner":"Michał Šrajer","answer_id":7451456,"question_score":279,"reviewed":true} | |
| {"id":"so-7517632","request":"Replace the literal string \"http://www.fubar.com\" with URL_FUBAR in the input.","command":"sed 's#\"http://www\\.fubar\\.com\"#URL_FUBAR#g'","input_text":"Visit \"http://www.fubar.com\" now.\nKeep \"http://other.com\".","expected_output":"Visit URL_FUBAR now.\nKeep \"http://other.com\".","validation_input":"Link: \"http://www.fubar.com\"","validation_output":"Link: URL_FUBAR","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7517632/how-do-i-escape-slashes-and-double-and-single-quotes-in-sed","question_title":"How do I escape slashes and double and single quotes in sed?","question_owner":"KRB","answer_owner":"Kusalananda","answer_id":7517900,"question_score":122,"reviewed":true} | |
| {"id":"so-8206280","request":"Delete all lines that begin with a hash character (#) from the input text.","command":"sed '/^#/d'","input_text":"# This is a comment\nThis is code\n# Another comment\nMore code # inline comment","expected_output":"This is code\nMore code # inline comment","validation_input":"# Comment line 1\nValid line 1\n# Comment line 2\nValid line 2 with # symbol","validation_output":"Valid line 1\nValid line 2 with # symbol","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8206280/delete-all-lines-beginning-with-a-from-a-file","question_title":"Delete all lines beginning with a # from a file","question_owner":"Village","answer_owner":"Raymond Hettinger","answer_id":8206295,"question_score":283,"reviewed":true} | |
| {"id":"so-8822097","request":"Replace any line starting with 'aaa=' followed by any characters with the line 'aaa=xxx'.","command":"sed 's/^aaa=.*/aaa=xxx/'","input_text":"aaa=bbb\naaa=ccc\naaa=ddd\nother=line","expected_output":"aaa=xxx\naaa=xxx\naaa=xxx\nother=line","validation_input":"aaa=test\nkeep=this\naaa=value","validation_output":"aaa=xxx\nkeep=this\naaa=xxx","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8822097/how-to-replace-a-whole-line-with-sed","question_title":"How to replace a whole line with sed?","question_owner":"Michael","answer_owner":"John Doyle","answer_id":8822211,"question_score":253,"reviewed":true} | |
| {"id":"so-9533679","request":"Prepend the text '<added text> ' to the beginning of the first line of the input stream without adding a new line.","command":"sed '1s/^/<added text> /'","input_text":"some text at the beginning\nsecond line","expected_output":"<added text> some text at the beginning\nsecond line","validation_input":"hello world","validation_output":"<added text> hello world","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9533679/how-to-insert-a-text-at-the-beginning-of-a-file","question_title":"How to insert a text at the beginning of a file?","question_owner":"user219882","answer_owner":"kev","answer_id":9533736,"question_score":350,"reviewed":true} | |
| {"id":"so-9605232","request":"Merge every two consecutive lines into a single line separated by a space.","command":"sed 'N;s/\\n/ /'","input_text":"KEY 4048:1736 string\n3\nKEY 0:1772 string\n1","expected_output":"KEY 4048:1736 string 3\nKEY 0:1772 string 1","validation_input":"Line A\nLine B\nLine C\nLine D","validation_output":"Line A Line B\nLine C Line D","family":"real-stackoverflow","difficulty":3,"split":"test","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,"reviewed":true} | |
| {"id":"so-9953448","request":"Remove every space and tab character from each input line.","command":"sed 's/[[:space:]]//g'","input_text":"Hello \t World\nNew Line","expected_output":"HelloWorld\nNewLine","validation_input":"a b\tc\nd","validation_output":"abc\nd","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9953448/how-to-remove-all-white-spaces-from-a-given-text-file","question_title":"How to remove all white spaces from a given text file?","question_owner":"Lunar Mushrooms","answer_owner":"Paulo Scardine","answer_id":9953487,"question_score":123,"reviewed":true} | |