File size: 29,632 Bytes
d96cf4e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{"id":"so-10754682","request":"Wrap each line in double quotes, handling potential carriage returns at the end of lines by removing them before quoting.","command":"sed 's/\\r$//; s/.*/\"&\"/'","input_text":"name,id,3\r\nuser,pass,4\r\n","expected_output":"\"name,id,3\"\n\"user,pass,4\"\n","validation_input":"hello,world\r\ntest,data\r\n","validation_output":"\"hello,world\"\n\"test,data\"\n","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/10754682/how-to-add-double-quotes-to-a-line-with-sed-or-awk","question_title":"How to add double quotes to a line with SED or AWK?","question_owner":"minerals","answer_owner":"Dennis Williamson","answer_id":10755347,"question_score":31,"reviewed":true}
{"id":"so-11687216","request":"Remove all blank lines from the input text.","command":"sed '/^$/d'","input_text":"Line 1\n\nLine 3\n\nLine 5","expected_output":"Line 1\nLine 3\nLine 5","validation_input":"Hello\n\nWorld\n\nEnd","validation_output":"Hello\nWorld\nEnd","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11687216/awk-to-skip-the-blank-lines","question_title":"Awk to skip the blank lines","question_owner":"Gil","answer_owner":"Levon","answer_id":11687266,"question_score":33,"reviewed":true}
{"id":"so-13202715","request":"Print only the lines that start with the prefix 'RIM-COD-' from the input text.","command":"sed -n -e '/^RIM-COD-/p'","input_text":"RIM-COD-URL-12: HelloWorld-12.cod\nRIM-COD-Size: 68020\nRIM-MIDlet-Icon-2-1: icon.png\nRIM-COD-URL-11: HelloWorld-11.cod","expected_output":"RIM-COD-URL-12: HelloWorld-12.cod\nRIM-COD-Size: 68020\nRIM-COD-URL-11: HelloWorld-11.cod","validation_input":"RIM-COD-URL-10: Test.cod\nOther-Line: Value\nRIM-COD-SHA1: abc123\nManifest-Version: 1.0","validation_output":"RIM-COD-URL-10: Test.cod\nRIM-COD-SHA1: abc123\n","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13202715/sed-get-lines-beginning-with-some-prefix","question_title":"Sed: get lines beginning with some prefix","question_owner":"CAMOBAP","answer_owner":"John3136","answer_id":13202727,"question_score":30,"reviewed":true}
{"id":"so-14046878","request":"Delete from the first line exactly matching '-----THIS STUFF IS USELESS-----' to the end of the input stream.","command":"sed '/^-----THIS STUFF IS USELESS-----$/,$d'","input_text":"Files:\nsomefiles.tar.gz 1 2 3\nsomefiles.tar.gz 1 2 3\n-----THIS STUFF IS USELESS-----\nBLEH BLEH BLEH\nBLEH BLEH BLEH","expected_output":"Files:\nsomefiles.tar.gz 1 2 3\nsomefiles.tar.gz 1 2 3\n","validation_input":"Header\nData Line 1\nData Line 2\n-----THIS STUFF IS USELESS-----\nFooter 1\nFooter 2","validation_output":"Header\nData Line 1\nData Line 2\n","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14046878/using-sed-to-match-a-pattern-and-deleting-from-the-line-to-the-end-of-the-file","question_title":"Using sed to match a pattern and deleting from the line to the end of the file","question_owner":"Albert H","answer_owner":"shellter","answer_id":14046990,"question_score":26,"reviewed":true}
{"id":"so-15632691","request":"Print only the first line of the input and then stop processing.","command":"sed -n '1{p;q}'","input_text":"Line 1\nLine 2\nLine 3","expected_output":"Line 1\n","validation_input":"First\nSecond\nThird\nFourth","validation_output":"First\n","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/15632691/fastest-way-to-print-a-single-line-in-a-file","question_title":"Fastest way to print a single line in a file","question_owner":"JBoy","answer_owner":"Chris Seymour","answer_id":15632780,"question_score":25,"reviewed":true}
{"id":"so-1617724","request":"Replace all newline characters with tab characters in the input stream.","command":"sed ':a;N;$!ba;s/\\n/\\t/g'","input_text":"hi\nhello\nhallo\ngreetings","expected_output":"hi\thello\thallo\tgreetings","validation_input":"salutations\nno more hello for you","validation_output":"salutations\tno more hello for you","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1617724/how-to-replace-newlines-with-tab-characters","question_title":"How to replace newlines with tab characters?","question_owner":"Vijay","answer_owner":"ghostdog74","answer_id":1617769,"question_score":24,"reviewed":true}
{"id":"so-16202900","request":"Remove spaces following commas only within lines 2 through 3 of the input.","command":"sed '2,3s/,\\s\\+/,/g'","input_text":"Line 1, with space\nLine 2, with space\nLine 3, with space\nLine 4, with space","expected_output":"Line 1, with space\nLine 2,with space\nLine 3,with space\nLine 4, with space","validation_input":"a, b\nb, c\nc, d\nd, e","validation_output":"a, b\nb,c\nc,d\nd, e","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/16202900/using-sed-between-specific-lines-only","question_title":"Using sed between specific lines only","question_owner":"hackio","answer_owner":"anubhava","answer_id":16202932,"question_score":26,"reviewed":true}
{"id":"so-16576197","request":"Insert a newline between '</a>' and '<a><a>' in the input stream.","command":"sed 's#</a><a><a>#</a>\\\n<a><a>#g'","input_text":"</a><a><a>\nsome text </a><a><a> more text","expected_output":"</a>\n<a><a>\nsome text </a>\n<a><a> more text","validation_input":"prefix</a><a><a>suffix\n</a><a><a>","validation_output":"prefix</a>\n<a><a>suffix\n</a>\n<a><a>","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/16576197/how-to-add-new-line-using-sed-on-macos","question_title":"How to add new line using sed on MacOS?","question_owner":"codereviewanskquestions","answer_owner":"Kevin","answer_id":16576291,"question_score":26,"reviewed":true}
{"id":"so-18602234","request":"Remove the period and everything following it on each line.","command":"sed 's/\\..*$//'","input_text":"95 flour.\n47 water.s\netc..","expected_output":"95 flour\n47 water\netc","validation_input":"hello.world\ntest.case.end","validation_output":"hello\ntest","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/18602234/sed-to-remove-everything-after-in-file-using-command","question_title":"Sed to remove everything after &quot;.&quot; in file using * command?","question_owner":"Novice","answer_owner":"Adam Rosenfield","answer_id":18602273,"question_score":25,"reviewed":true}
{"id":"so-20568515","request":"Replace the value of the variable VAR5 with VALUE10 in a configuration file content, keeping the key name intact.","command":"sed 's/^\\(VAR5=\\).*/\\1VALUE10/'","input_text":"VAR1=VALUE1\nVAR2=VALUE2\nVAR3=VALUE3\nVAR4=VALUE4\nVAR5=VALUE5\nVAR6=VALUE6","expected_output":"VAR1=VALUE1\nVAR2=VALUE2\nVAR3=VALUE3\nVAR4=VALUE4\nVAR5=VALUE10\nVAR6=VALUE6","validation_input":"KEY=OLD\nVAR5=SOMETHING\nOTHER=DATA","validation_output":"KEY=OLD\nVAR5=VALUE10\nOTHER=DATA","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20568515/how-to-use-sed-to-replace-a-config-files-variable","question_title":"How to use sed to replace a config file&#39;s variable?","question_owner":"SomeGuyOnAComputer","answer_owner":"anubhava","answer_id":20568559,"question_score":32,"reviewed":true}
{"id":"so-22159044","request":"Append the string ' myalias' to the end of any line containing '192.168.1.2'.","command":"sed '/192.168.1.2/s/$/ myalias/'","input_text":"192.168.1.1    www.address1.com\n192.168.1.2    www.address2.com\n192.168.1.3    www.address3.com","expected_output":"192.168.1.1    www.address1.com\n192.168.1.2    www.address2.com myalias\n192.168.1.3    www.address3.com","validation_input":"10.0.0.1 host1\n192.168.1.2 host2\n10.0.0.3 host3","validation_output":"10.0.0.1 host1\n192.168.1.2 host2 myalias\n10.0.0.3 host3","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/22159044/how-to-append-a-string-at-end-of-a-specific-line-in-a-file-in-bash","question_title":"How to append a string at end of a specific line in a file in bash","question_owner":"Chris F","answer_owner":"Steve","answer_id":22159086,"question_score":30,"reviewed":true}
{"id":"so-22939323","request":"Replace sequences of two or more spaces with a single space in the input text.","command":"sed -e 's/  */ /g'","input_text":"iiHi Hello   Hi\nthis   is   loga","expected_output":"iiHi Hello Hi\nthis is loga","validation_input":"a  b   c    d\ne     f","validation_output":"a b c d\ne f","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/22939323/sed-command-to-replace-multiple-spaces-into-single-spaces","question_title":"sed command to replace multiple spaces into single spaces","question_owner":"logan","answer_owner":"John Zwinck","answer_id":22939416,"question_score":25,"reviewed":true}
{"id":"so-24427009","request":"Extract the last three characters from every line of the input.","command":"sed -e 's/^.*\\(...\\)$/\\1/'","input_text":"hello\nworld\nabcdef","expected_output":"llo\nrld\ndef","validation_input":"short\nlonger string\nxyz","validation_output":"ort\ning\nxyz","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/24427009/is-there-a-cleaner-way-of-getting-the-last-n-characters-of-every-line","question_title":"Is there a cleaner way of getting the last N characters of every line?","question_owner":"merlin2011","answer_owner":"Tiago Lopo","answer_id":24427087,"question_score":32,"reviewed":true}
{"id":"so-25491847","request":"Extract only the second word from each line of text.","command":"sed -n 's/^[[:space:]]*[^[:space:]]*[[:space:]]\\+\\([^[:space:]]*\\).*/\\1/p'","input_text":"*   CRISTOBAL  AL042014  08/05/14  12  UTC   *\nthis is a test","expected_output":"CRISTOBAL\nis","validation_input":"  hello world foo\none two","validation_output":"world\ntwo","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/25491847/extract-the-second-word-in-a-line-from-a-text-file","question_title":"Extract The Second Word In A Line From A Text File","question_owner":"Aaron Perry","answer_owner":"zedfoxus","answer_id":25491964,"question_score":32,"reviewed":true}
{"id":"so-28795479","request":"Convert camelCase text to underscore_case by inserting an underscore before uppercase letters and lowercasing them.","command":"sed 's/\\([a-z0-9]\\)\\([A-Z]\\)/\\1_\\2/g; s/.*/\\L&/'","input_text":"fooBar\nmyVariableName\nsimpleTest","expected_output":"foo_bar\nmy_variable_name\nsimple_test","validation_input":"getUserName\nparseXMLData","validation_output":"get_user_name\nparse_xmldata","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/28795479/awk-sed-script-to-convert-a-file-from-camelcase-to-underscores","question_title":"Awk/sed script to convert a file from camelCase to underscores","question_owner":"Corentin Peuvrel","answer_owner":"Avinash Raj","answer_id":28795550,"question_score":25,"reviewed":true}
{"id":"so-31903432","request":"Replace all tab characters with four spaces in the input text.","command":"sed 's/\\t/    /g'","input_text":"col1\tcol2\tcol3\nval1\tval2\tval3","expected_output":"col1    col2    col3\nval1    val2    val3","validation_input":"a\tb\n\tc","validation_output":"a    b\n    c","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/31903432/using-sed-to-replace-tab-with-spaces","question_title":"Using sed to replace tab with spaces","question_owner":"manshuai","answer_owner":"anubhava","answer_id":31903444,"question_score":28,"reviewed":true}
{"id":"so-31911179","request":"Delete the first line of the input stream.","command":"sed '1d'","input_text":"Header\nLine1\nLine2","expected_output":"Line1\nLine2","validation_input":"Title\nData A\nData B","validation_output":"Data A\nData B","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/31911179/ignoring-first-line-column-header-while-reading-a-file-in-bash","question_title":"Ignoring First line/Column header while reading a file in bash","question_owner":"Jai","answer_owner":"chepner","answer_id":31911198,"question_score":28,"reviewed":true}
{"id":"so-3194534","request":"Join every pair of consecutive lines by appending the second line to the first, effectively merging line 2 into line 1, line 4 into line 3, and so on.","command":"sed '$!N;s/\\n//'","input_text":"abcd\njoinabcd\nefgh\njoinefgh\nijkl\njoinijkl","expected_output":"abcdjoinabcd\nefghjoinefgh\nijkljoinijkl","validation_input":"line1\nline2\nline3\nline4","validation_output":"line1line2\nline3line4","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3194534/joining-two-consecutive-lines-using-awk-or-sed","question_title":"Joining two consecutive lines using awk or sed","question_owner":"Vijay","answer_owner":"Dimitre Radoulov","answer_id":3196948,"question_score":26,"reviewed":true}
{"id":"so-3302434","request":"Remove the substring 'ko:' from each line, keeping the rest of the text intact.","command":"sed 's/ko://'","input_text":"ko04062 ko:CXCR3\nko04062 ko:CX3CR1\nko04062 ko:CCL3","expected_output":"ko04062 CXCR3\nko04062 CX3CR1\nko04062 CCL3","validation_input":"ko04080 ko:GZMA\nko05414 ko:ITGA4","validation_output":"ko04080 GZMA\nko05414 ITGA4","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3302434/capturing-groups-in-sed","question_title":"capturing groups in sed","question_owner":"Mike Dewar","answer_owner":"ninjalj","answer_id":3302593,"question_score":25,"reviewed":true}
{"id":"so-34576667","request":"Replace the text 'Foo' with 'Bar' in the input stream.","command":"sed -e 's/Foo/Bar/'","input_text":"Foo","expected_output":"Bar","validation_input":"Hello Foo World","validation_output":"Hello Bar World","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/34576667/sed-unescaped-newline-inside-substitute-pattern","question_title":"sed: unescaped newline inside substitute pattern?","question_owner":"RocketNuts","answer_owner":"anubhava","answer_id":34576684,"question_score":30,"reviewed":true}
{"id":"so-3576139","request":"Remove the string 'line number' only if it appears in the last line of the input.","command":"sed '$ s/line number//g'","input_text":"first line number\nsecond line number\nlast line number","expected_output":"first line number\nsecond line number\nlast ","validation_input":"keep line number\nremove line number","validation_output":"keep line number\nremove ","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3576139/sed-remove-string-only-in-the-last-line-of-the-file","question_title":"sed + remove string only in the last line of the file","question_owner":"lidia","answer_owner":"Scharron","answer_id":3576183,"question_score":31,"reviewed":true}
{"id":"so-39198780","request":"Replace all newline characters with a single space in the input stream.","command":"sed ':a;N;$!ba;s/\\n/ /g'","input_text":"my\nname\nis\nxxxx","expected_output":"my name is xxxx","validation_input":"hello\nworld","validation_output":"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/39198780/replace-nnew-line-with-space-in-bash","question_title":"Replace \\n(new line) with space in bash","question_owner":"Prometheus","answer_owner":"Cyrus","answer_id":39198829,"question_score":24,"reviewed":true}
{"id":"so-39648222","request":"Convert a multi-line text stream into a single line by replacing all newline characters with spaces, effectively joining the lines.","command":"sed ':a;N;$!ba;s/\\n/ /g'","input_text":"{\n\"key\": \"value\"\n}","expected_output":"{ \"key\": \"value\" }","validation_input":"Line 1\nLine 2\nLine 3","validation_output":"Line 1 Line 2 Line 3","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/39648222/converting-json-pretty-print-to-one-line","question_title":"Converting JSON pretty print to one line","question_owner":"h.b","answer_owner":"P....","answer_id":39653559,"question_score":29,"reviewed":true}
{"id":"so-40506782","request":"Remove all characters from the beginning of each line up to and including the first occurrence of the digit '2'.","command":"sed 's/^[^2]*2//'","input_text":"ananas1kiwi2apple1banana2tree\nhello2world\ntest","expected_output":"apple1banana2tree\nworld\ntest","validation_input":"abc2def2ghi\nno_match_here\n123","validation_output":"def2ghi\nno_match_here\n3","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/40506782/delete-everyting-preceding-and-including-a-certain-substring-from-variable","question_title":"Delete everyting preceding and including a certain substring from variable","question_owner":"Anne K.","answer_owner":"heemayl","answer_id":40506863,"question_score":27,"reviewed":true}
{"id":"so-5024357","request":"Read lines from standard input and print them until a line containing the exact string 'EOF' is encountered. The line containing 'EOF' should also be printed, and then the program should stop processing further input.","command":"sed '/EOF/q'","input_text":"Line 1\nLine 2\nThis is EOF\nLine 4","expected_output":"Line 1\nLine 2\nThis is EOF\n","validation_input":"Start\nMiddle\nEnd with EOF marker\nIgnored line","validation_output":"Start\nMiddle\nEnd with EOF marker\n","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5024357/do-a-tail-f-until-matching-a-pattern","question_title":"Do a tail -F until matching a pattern","question_owner":"Sam Alba","answer_owner":"jpetazzo","answer_id":5033775,"question_score":27,"reviewed":true}
{"id":"so-5544322","request":"Extract and clean the value from lines starting with 'Important1: ', removing the prefix and surrounding whitespace, while suppressing all other lines.","command":"sed -n 's/^Important1: *\\([^ ]*\\) */\\1/p'","input_text":"Bla\nBla\nImportant1: One \nBla\nImportant2: Two\nBla\nBla","expected_output":"One\n","validation_input":"Ignore this\nImportant1: Value \nIgnore that\nImportant1: Another","validation_output":"Value\nAnother","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5544322/sed-get-only-the-replaced-string-from-a-multiline-input-omit-unmatched-lines","question_title":"sed - Get only the replaced string from a multiline input &amp; omit unmatched lines!","question_owner":"porg","answer_owner":"anubhava","answer_id":5544539,"question_score":26,"reviewed":true}
{"id":"so-6006132","request":"Print only the lines that do not end with the string 'abcd'.","command":"sed -n '/abcd$/!p'","input_text":"this is abcd\nthis is not\nanother abcd\nend","expected_output":"this is not\nend","validation_input":"xyzabcd\nkeep this line\nfoo bar abcd\nretain","validation_output":"keep this line\nretain","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6006132/grep-line-of-text-that-does-not-end-with-abcd","question_title":"Grep. Line of text that does not end with &quot;abcd&quot;?","question_owner":"CCC","answer_owner":"tobyodavies","answer_id":6006139,"question_score":27,"reviewed":true}
{"id":"so-6011661","request":"Extract the two-digit number surrounded by identical non-digit characters from each line. If a line does not match this pattern, produce no output for that line.","command":"sed -n 's/^.*\\(.\\)\\([0-9][0-9]\\)\\1.*$/\\2/p'","input_text":"plop-02-plop\nabcX99Xdef\nno-match-here\nz55z","expected_output":"02\n99\n55","validation_input":"testA12Aend\nfailB1C\nok_77_","validation_output":"12\n77","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6011661/regexp-sed-suppress-no-match-output","question_title":"regexp (sed) suppress &quot;no match&quot; output","question_owner":"yPhil","answer_owner":"przemoc","answer_id":6011704,"question_score":28,"reviewed":true}
{"id":"so-6869449","request":"Delete lines matching the regex '^Name' but skip the first line of the input.","command":"sed -e '2,${ /^Name/d }'","input_text":"Name\nJohn\nAlbert\nMora\nName\nTommy\nTammy","expected_output":"Name\nJohn\nAlbert\nMora\nTommy\nTammy","validation_input":"Header\nData1\nHeader\nData2\nFooter","validation_output":"Header\nData1\nHeader\nData2\nFooter","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6869449/skipping-the-first-n-lines-when-using-regex-with-sed","question_title":"Skipping the first n lines when using regex with sed?","question_owner":"Legend","answer_owner":"a&#39;r","answer_id":6869486,"question_score":26,"reviewed":true}
{"id":"so-689495","request":"Convert the uppercase letter immediately following an underscore in identifiers starting with 'get' to lowercase.","command":"sed -e 's/\\(get[A-Z][A-Za-z0-9]*_\\)\\([A-Z]\\)/\\1\\L\\2/g'","input_text":"getFoo_Bar\ngetBaz_Qux","expected_output":"getFoo_bar\ngetBaz_qux","validation_input":"getX_Y\ngetAb_Cd_Ef","validation_output":"getX_y\ngetAb_cd_Ef","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/689495/upper-to-lower-case-using-sed","question_title":"upper- to lower-case using sed","question_owner":"cadrian","answer_owner":"strager","answer_id":689608,"question_score":25,"reviewed":true}
{"id":"so-8225822","request":"Replace all occurrences of 'A' with 'a' and only print lines where a substitution was made.","command":"sed -n 's/A/a/gp'","input_text":"Apple\nBanana\nAvocado","expected_output":"apple\navocado","validation_input":"ABC\nXYZ\nA123","validation_output":"aBC\na123","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8225822/how-to-make-sed-remove-lines-not-matched-by-a-substitution","question_title":"How to make sed remove lines not matched by a substitution","question_owner":"Ropez","answer_owner":"jaypal singh","answer_id":8255627,"question_score":28,"reviewed":true}
{"id":"so-8356958","request":"Remove the prefix 'foo: ' from the beginning of each line in the input text.","command":"sed 's/^foo: //'","input_text":"foo: bar1\nfoo: bar2\nfoo: bar3","expected_output":"bar1\nbar2\nbar3","validation_input":"foo: hello world\nfoo: test case\nno match here","validation_output":"hello world\ntest case\nno match here","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8356958/sed-just-trying-to-remove-a-substring","question_title":"sed: just trying to remove a substring","question_owner":"user1077220","answer_owner":"aefxx","answer_id":8356980,"question_score":28,"reviewed":true}
{"id":"so-8394066","request":"Insert a line containing two words separated by a tab character at the beginning of the input.","command":"sed '1i\\\nword1\tword2'","input_text":"Existing line 1\nExisting line 2","expected_output":"word1\tword2\nExisting line 1\nExisting line 2","validation_input":"Data start","validation_output":"word1\tword2\nData start","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8394066/what-is-the-proper-way-to-insert-tab-in-sed","question_title":"What is the proper way to insert tab in sed?","question_owner":"dabest1","answer_owner":"Jonathan Leffler","answer_id":8394150,"question_score":33,"reviewed":true}
{"id":"so-8991275","request":"Replace the character 'b' with a newline in the input stream.","command":"sed 's/b/\\\n/'","input_text":"abc","expected_output":"a\nc","validation_input":"xbx","validation_output":"x\nx","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8991275/escaping-newlines-in-sed-replacement-string","question_title":"escaping newlines in sed replacement string","question_owner":"spraff","answer_owner":"jaypal singh","answer_id":8991356,"question_score":29,"reviewed":true}
{"id":"so-9191030","request":"Remove all occurrences of the substring 'ABC' from the end of each line.","command":"sed 's/\\(ABC\\)*$//'","input_text":"DAAAAABCBBBCCABCABC\nHelloABC\nWorld","expected_output":"DAAAAABCBBBCC\nHello\nWorld","validation_input":"TestABCABC\nNoChange\nEndABC","validation_output":"Test\nNoChange\nEnd","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9191030/removing-pattern-at-the-end-of-a-string-using-sed-or-other-bash-tools","question_title":"Removing pattern at the end of a string using sed or other bash tools","question_owner":"Kay Chan","answer_owner":"Birei","answer_id":9191062,"question_score":30,"reviewed":true}
{"id":"so-9260625","request":"Extract the first sequence of digits from each line of input text.","command":"sed -n 's/^[^0-9]*\\([0-9][0-9]*\\).*/\\1/p'","input_text":"This is an example: 65 apples\nThere are 123 items here","expected_output":"65\n123","validation_input":"No numbers in this line\nValue is 42 and count is 7","validation_output":"42","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9260625/sed-extracting-group-of-digits","question_title":"sed extracting group of digits","question_owner":"Uthman","answer_owner":"codaddict","answer_id":9260734,"question_score":24,"reviewed":true}
{"id":"so-9970124","request":"Insert the line 'New Inserted Line' immediately after the first occurrence of 'Matched Keyword', before any remaining text on that line.","command":"sed '0,/Matched Keyword/s//Matched Keyword\\nNew Inserted Line/'","input_text":"Line 1\nLine 2\nThis line contains the Matched Keyword and other stuff\nLine 4\nThis line contains the Matched Keyword and other stuff\nLine 6","expected_output":"Line 1\nLine 2\nThis line contains the Matched Keyword\nNew Inserted Line and other stuff\nLine 4\nThis line contains the Matched Keyword and other stuff\nLine 6","validation_input":"Start\nMiddle Matched Keyword End\nEnd Matched Keyword Start\nFinish","validation_output":"Start\nMiddle Matched Keyword\nNew Inserted Line End\nEnd Matched Keyword Start\nFinish","family":"real-stackoverflow","difficulty":3,"split":"test","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9970124/sed-to-insert-on-first-match-only","question_title":"sed to insert on first match only","question_owner":"SSS","answer_owner":"Squazic","answer_id":9970467,"question_score":26,"reviewed":true}