{"id":"so-10613643","request":"Replace the content between 'WORD1' and 'WORD3' on the same line with 'foo', preserving 'WORD1' and 'WORD3'.","command":"sed -e 's/WORD1.*WORD3/WORD1 foo WORD3/g'","input_text":"WORD1 WORD2 WORD3\nWORD1 abcdef WORD3\nNo match here","expected_output":"WORD1 foo WORD3\nWORD1 foo WORD3\nNo match here","validation_input":"WORD1 xyz WORD3\nWORD1 123 WORD3 extra\nWORD1 WORD3","validation_output":"WORD1 foo WORD3\nWORD1 foo WORD3 extra\nWORD1 foo WORD3","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/10613643/replace-a-unknown-string-between-two-known-strings-with-sed","question_title":"replace a unknown string between two known strings with sed","question_owner":"Camden S.","answer_owner":"vyegorov","answer_id":10613688,"question_score":40,"reviewed":true} {"id":"so-10613643-p1","request":"On each line, substitute the text situated between 'WORD1' and 'WORD3' with 'foo', while keeping 'WORD1' and 'WORD3' intact.","command":"sed -e 's/WORD1.*WORD3/WORD1 foo WORD3/g'","input_text":"WORD1 WORD2 WORD3\nWORD1 abcdef WORD3\nNo match here","expected_output":"WORD1 foo WORD3\nWORD1 foo WORD3\nNo match here","validation_input":"WORD1 xyz WORD3\nWORD1 123 WORD3 extra\nWORD1 WORD3","validation_output":"WORD1 foo WORD3\nWORD1 foo WORD3 extra\nWORD1 foo WORD3","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/10613643/replace-a-unknown-string-between-two-known-strings-with-sed","question_title":"replace a unknown string between two known strings with sed","question_owner":"Camden S.","answer_owner":"vyegorov","answer_id":10613688,"question_score":40,"reviewed":true,"paraphrase_of":"so-10613643","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-1074450","request":"Replace the value following 'DBSERVERNAME' (separated by whitespace) with 'yyy', preserving the key name and case-insensitivity.","command":"sed -e 's/\\(DBSERVERNAME\\)[[:space:]]\\+[[:alnum:]_]\\+/\\1 yyy/I'","input_text":"DBSERVERNAME\txxx\nOTHERKEY\tvalue","expected_output":"DBSERVERNAME yyy\nOTHERKEY\tvalue","validation_input":"dbservername old_value\nDBSERVERNAME new_val","validation_output":"dbservername yyy\nDBSERVERNAME yyy","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1074450/sed-replace-part-of-a-line","question_title":"sed: Replace part of a line","question_owner":"calvinkrishy","answer_owner":"Jeremy Stein","answer_id":1074533,"question_score":49,"reviewed":true} {"id":"so-1074450-p1","request":"Update the value associated with 'DBSERVERNAME' (delimited by whitespace) to 'yyy', maintaining the key name and ensuring case-insensitive matching.","command":"sed -e 's/\\(DBSERVERNAME\\)[[:space:]]\\+[[:alnum:]_]\\+/\\1 yyy/I'","input_text":"DBSERVERNAME\txxx\nOTHERKEY\tvalue","expected_output":"DBSERVERNAME yyy\nOTHERKEY\tvalue","validation_input":"dbservername old_value\nDBSERVERNAME new_val","validation_output":"dbservername yyy\nDBSERVERNAME yyy","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1074450/sed-replace-part-of-a-line","question_title":"sed: Replace part of a line","question_owner":"calvinkrishy","answer_owner":"Jeremy Stein","answer_id":1074533,"question_score":49,"reviewed":true,"paraphrase_of":"so-1074450","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-1187078","request":"Insert a newline character after every 20 characters in the input text.","command":"sed -e 's/.\\{20\\}/&\\n/g'","input_text":"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz","expected_output":"ABCDEFGHIJKLMNOPQRST\nUVWXYZ0123456789abcd\nefghijklmnopqrstuvwx\nyz","validation_input":"123456789012345678901234567890","validation_output":"12345678901234567890\n1234567890","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1187078/how-to-insert-a-new-line-character-after-a-fixed-number-of-characters-in-a-file","question_title":"How to insert a new line character after a fixed number of characters in a file","question_owner":"rangalo","answer_owner":"Kristian","answer_id":1187225,"question_score":48,"reviewed":true} {"id":"so-1187078-p1","request":"Break the input text by inserting a newline character after every 20 characters.","command":"sed -e 's/.\\{20\\}/&\\n/g'","input_text":"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz","expected_output":"ABCDEFGHIJKLMNOPQRST\nUVWXYZ0123456789abcd\nefghijklmnopqrstuvwx\nyz","validation_input":"123456789012345678901234567890","validation_output":"12345678901234567890\n1234567890","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1187078/how-to-insert-a-new-line-character-after-a-fixed-number-of-characters-in-a-file","question_title":"How to insert a new line character after a fixed number of characters in a file","question_owner":"rangalo","answer_owner":"Kristian","answer_id":1187225,"question_score":48,"reviewed":true,"paraphrase_of":"so-1187078","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-1187354","request":"Comment out all lines between the start marker '=sec1=' and the end marker '=sec2=', excluding the marker lines themselves.","command":"sed -e '/=sec1=/,/=sec2=/ { /=sec1=/b; /=sec2=/b; s/^/#/ }'","input_text":"=sec1=\nsome-line\nsome-other-line\nfoo\nbar=baz\n=sec2=\nc=baz","expected_output":"=sec1=\n#some-line\n#some-other-line\n#foo\n#bar=baz\n=sec2=\nc=baz","validation_input":"=sec1=\nkeep this\nand this\n=sec2=\noutside","validation_output":"=sec1=\n#keep this\n#and this\n=sec2=\noutside","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1187354/excluding-first-and-last-lines-from-sed-start-end","question_title":"excluding first and last lines from sed /START/,/END/","question_owner":"Chen Levy","answer_owner":"Ville Laurikari","answer_id":1187517,"question_score":53,"reviewed":true} {"id":"so-1187354-p1","request":"Add comment markers to all lines located between '=sec1=' and '=sec2=', but do not modify the marker lines themselves.","command":"sed -e '/=sec1=/,/=sec2=/ { /=sec1=/b; /=sec2=/b; s/^/#/ }'","input_text":"=sec1=\nsome-line\nsome-other-line\nfoo\nbar=baz\n=sec2=\nc=baz","expected_output":"=sec1=\n#some-line\n#some-other-line\n#foo\n#bar=baz\n=sec2=\nc=baz","validation_input":"=sec1=\nkeep this\nand this\n=sec2=\noutside","validation_output":"=sec1=\n#keep this\n#and this\n=sec2=\noutside","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1187354/excluding-first-and-last-lines-from-sed-start-end","question_title":"excluding first and last lines from sed /START/,/END/","question_owner":"Chen Levy","answer_owner":"Ville Laurikari","answer_id":1187517,"question_score":53,"reviewed":true,"paraphrase_of":"so-1187354","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-11958369","request":"Replace 'mystring' with '1' if the line contains 'searchstring', otherwise replace 'mystring' with '0'.","command":"sed -e '/searchstring/ s/mystring/1/ ; s/mystring/0/'","input_text":"some text mystring some other text\nsome text mystring a searchstring\njust some more text","expected_output":"some text 0 some other text\nsome text 1 a searchstring\njust some more text","validation_input":"mystring here\nno match mystring\nsearchstring and mystring","validation_output":"0 here\nno match 0\nsearchstring and 1","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11958369/replace-only-if-string-exists-in-current-line","question_title":"Replace only if string exists in current line","question_owner":"Anders Lind","answer_owner":"Ihor Kaharlichenko","answer_id":11958566,"question_score":41,"reviewed":true} {"id":"so-11958369-p1","request":"If a line includes 'searchstring', change 'mystring' to '1'; otherwise, change 'mystring' to '0'.","command":"sed -e '/searchstring/ s/mystring/1/ ; s/mystring/0/'","input_text":"some text mystring some other text\nsome text mystring a searchstring\njust some more text","expected_output":"some text 0 some other text\nsome text 1 a searchstring\njust some more text","validation_input":"mystring here\nno match mystring\nsearchstring and mystring","validation_output":"0 here\nno match 0\nsearchstring and 1","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/11958369/replace-only-if-string-exists-in-current-line","question_title":"Replace only if string exists in current line","question_owner":"Anders Lind","answer_owner":"Ihor Kaharlichenko","answer_id":11958566,"question_score":41,"reviewed":true,"paraphrase_of":"so-11958369","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-12061410","request":"Replace the string 'AAA' with 'BBB' in the input text, using '+' as the delimiter to avoid conflicts with forward slashes in paths.","command":"sed 's+AAA+BBB+'","input_text":"path is AAA/subdir","expected_output":"path is BBB/subdir","validation_input":"AAA/BBB/CCC","validation_output":"BBB/BBB/CCC","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/12061410/how-to-replace-a-path-with-another-path-in-sed","question_title":"How to replace a path with another path in sed?","question_owner":"Brian Postow","answer_owner":"Lev Levitsky","answer_id":12061491,"question_score":100,"reviewed":true} {"id":"so-12061410-p1","request":"Substitute 'AAA' with 'BBB' throughout the text, employing '+' as the delimiter to prevent issues with forward slashes in file paths.","command":"sed 's+AAA+BBB+'","input_text":"path is AAA/subdir","expected_output":"path is BBB/subdir","validation_input":"AAA/BBB/CCC","validation_output":"BBB/BBB/CCC","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/12061410/how-to-replace-a-path-with-another-path-in-sed","question_title":"How to replace a path with another path in sed?","question_owner":"Brian Postow","answer_owner":"Lev Levitsky","answer_id":12061491,"question_score":100,"reviewed":true,"paraphrase_of":"so-12061410","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-12297859","request":"Remove all characters from the beginning of each line up to and including the first colon character.","command":"sed 's/^[^:]*://'","input_text":"TF_list_to_test10004/Nus_k0.345_t0.1_e0.1.adj:PKMYT1\nGeneID:BRCA2","expected_output":"PKMYT1\nBRCA2","validation_input":"prefix:value\nno_colon_here\nkey:data_point","validation_output":"value\nno_colon_here\ndata_point","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,"reviewed":true} {"id":"so-12297859-p1","request":"Strip all characters from the start of each line up to and including the first colon.","command":"sed 's/^[^:]*://'","input_text":"TF_list_to_test10004/Nus_k0.345_t0.1_e0.1.adj:PKMYT1\nGeneID:BRCA2","expected_output":"PKMYT1\nBRCA2","validation_input":"prefix:value\nno_colon_here\nkey:data_point","validation_output":"value\nno_colon_here\ndata_point","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,"reviewed":true,"paraphrase_of":"so-12297859","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-12974162","request":"Extract the sequence of digits that appears immediately before the file extension in a pathname string.","command":"sed -n 's/.*_\\([0-9]*\\)\\..*/\\1/p'","input_text":"./pentaray_run2/Trace_220560.dat","expected_output":"220560","validation_input":"/path/to/file_log_987.csv","validation_output":"987","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/12974162/extract-numbers-from-a-string-using-sed-and-regular-expressions","question_title":"Extract numbers from a string using sed and regular expressions","question_owner":"Steven","answer_owner":"Kent","answer_id":12974208,"question_score":34,"reviewed":true} {"id":"so-12974162-p1","request":"Retrieve the digit sequence found directly before the file extension in a given path string.","command":"sed -n 's/.*_\\([0-9]*\\)\\..*/\\1/p'","input_text":"./pentaray_run2/Trace_220560.dat","expected_output":"220560","validation_input":"/path/to/file_log_987.csv","validation_output":"987","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/12974162/extract-numbers-from-a-string-using-sed-and-regular-expressions","question_title":"Extract numbers from a string using sed and regular expressions","question_owner":"Steven","answer_owner":"Kent","answer_id":12974208,"question_score":34,"reviewed":true,"paraphrase_of":"so-12974162","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-13316437","request":"Insert the line 'New Inserted Line' immediately after every occurrence of the line containing exactly 'fields'.","command":"sed '/^fields$/a\\New Inserted Line'","input_text":"line 1\nline 2\nfields\nline 3\nanother line\nfields\ndkhs","expected_output":"line 1\nline 2\nfields\nNew Inserted Line\nline 3\nanother line\nfields\nNew Inserted Line\ndkhs","validation_input":"start\nfields\nend","validation_output":"start\nfields\nNew Inserted Line\nend","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13316437/insert-lines-in-a-file-starting-from-a-specific-line","question_title":"Insert lines in a file starting from a specific line","question_owner":"Sadiel","answer_owner":"Chris Seymour","answer_id":13316554,"question_score":66,"reviewed":true} {"id":"so-13316437-p1","request":"Add the line 'New Inserted Line' right after any line that consists exactly of 'fields'.","command":"sed '/^fields$/a\\New Inserted Line'","input_text":"line 1\nline 2\nfields\nline 3\nanother line\nfields\ndkhs","expected_output":"line 1\nline 2\nfields\nNew Inserted Line\nline 3\nanother line\nfields\nNew Inserted Line\ndkhs","validation_input":"start\nfields\nend","validation_output":"start\nfields\nNew Inserted Line\nend","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13316437/insert-lines-in-a-file-starting-from-a-specific-line","question_title":"Insert lines in a file starting from a specific line","question_owner":"Sadiel","answer_owner":"Chris Seymour","answer_id":13316554,"question_score":66,"reviewed":true,"paraphrase_of":"so-13316437","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-13538772","request":"Replace every space character with a comma in the input text.","command":"sed 's/ /,/g'","input_text":"53 51097 310780 1\n56 260 1925 1\n68 51282 278770 1","expected_output":"53,51097,310780,1\n56,260,1925,1\n68,51282,278770,1","validation_input":"a b c d\ne f g h","validation_output":"a,b,c,d\ne,f,g,h","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13538772/how-to-replace-space-with-comma-using-sed","question_title":"How to replace space with comma using sed?","question_owner":"Teja","answer_owner":"mvp","answer_id":13538795,"question_score":36,"reviewed":true} {"id":"so-13538772-p1","request":"Convert all space characters in the input text to commas.","command":"sed 's/ /,/g'","input_text":"53 51097 310780 1\n56 260 1925 1\n68 51282 278770 1","expected_output":"53,51097,310780,1\n56,260,1925,1\n68,51282,278770,1","validation_input":"a b c d\ne f g h","validation_output":"a,b,c,d\ne,f,g,h","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13538772/how-to-replace-space-with-comma-using-sed","question_title":"How to replace space with comma using sed?","question_owner":"Teja","answer_owner":"mvp","answer_id":13538795,"question_score":36,"reviewed":true,"paraphrase_of":"so-13538772","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-13586349","request":"Prepend the string 'prefix' to the beginning of each line in the input.","command":"sed 's/^/prefix/'","input_text":"line1\nline2","expected_output":"prefixline1\nprefixline2","validation_input":"hello\nworld","validation_output":"prefixhello\nprefixworld","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13586349/how-can-i-prepend-a-string-to-the-beginning-of-each-line-in-a-file","question_title":"How can I prepend a string to the beginning of each line in a file?","question_owner":"bobbyrne01","answer_owner":"nullrevolution","answer_id":13587466,"question_score":55,"reviewed":true} {"id":"so-13586349-p1","request":"Add the string 'prefix' to the start of every line in the input.","command":"sed 's/^/prefix/'","input_text":"line1\nline2","expected_output":"prefixline1\nprefixline2","validation_input":"hello\nworld","validation_output":"prefixhello\nprefixworld","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/13586349/how-can-i-prepend-a-string-to-the-beginning-of-each-line-in-a-file","question_title":"How can I prepend a string to the beginning of each line in a file?","question_owner":"bobbyrne01","answer_owner":"nullrevolution","answer_id":13587466,"question_score":55,"reviewed":true,"paraphrase_of":"so-13586349","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-14135027","request":"Replace Danish characters 'æ', 'ø', and 'å' with 'ae', 'oe', and 'aa' respectively, and their uppercase counterparts 'Æ', 'Ø', 'Å' with 'Ae', 'Oe', and 'Aa' respectively.","command":"sed 's/æ/ae/g;s/ø/oe/g;s/å/aa/g;s/Æ/Ae/g;s/Ø/Oe/g;s/Å/Aa/g'","input_text":"Rødgrød med flæsk\nÅrhus Øl","expected_output":"Roedgroed med flaesk\nAarhus Oel","validation_input":"Jeg spiser grød\nÆblet er sødt","validation_output":"Jeg spiser groed\nAeblet er soedt","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14135027/regular-expression-in-sed-for-multiple-replacements-in-one-statement","question_title":"Regular Expression in sed for multiple replacements in one statement","question_owner":"Jan","answer_owner":"Anders Johansson","answer_id":14135068,"question_score":45,"reviewed":true} {"id":"so-14135027-p1","request":"Translate Danish letters 'æ', 'ø', 'å' to 'ae', 'oe', 'aa' and their uppercase forms 'Æ', 'Ø', 'Å' to 'Ae', 'Oe', 'Aa' respectively.","command":"sed 's/æ/ae/g;s/ø/oe/g;s/å/aa/g;s/Æ/Ae/g;s/Ø/Oe/g;s/Å/Aa/g'","input_text":"Rødgrød med flæsk\nÅrhus Øl","expected_output":"Roedgroed med flaesk\nAarhus Oel","validation_input":"Jeg spiser grød\nÆblet er sødt","validation_output":"Jeg spiser groed\nAeblet er soedt","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14135027/regular-expression-in-sed-for-multiple-replacements-in-one-statement","question_title":"Regular Expression in sed for multiple replacements in one statement","question_owner":"Jan","answer_owner":"Anders Johansson","answer_id":14135068,"question_score":45,"reviewed":true,"paraphrase_of":"so-14135027","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-14137353","request":"Comment out any line containing the string 'myvar' by prepending '//' to the beginning of that line.","command":"sed 's/\\(^.*myvar.*$\\)/\\/\\/\\1/'","input_text":"class hw {\npublic static void main(String[] args) {\nSystem.out.println(\"Hello World!\");\nmyvar=1\n}\n}","expected_output":"class hw {\npublic static void main(String[] args) {\nSystem.out.println(\"Hello World!\");\n//myvar=1\n}\n}","validation_input":"int x = 0;\nmyvar++;\n// myvar is here\nint y = myvar + 1;","validation_output":"int x = 0;\n//myvar++;\n//// myvar is here\n//int y = myvar + 1;","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14137353/using-sed-to-replace-beginning-of-line-when-match-found","question_title":"Using sed to replace beginning of line when match found","question_owner":"dublintech","answer_owner":"Chris Seymour","answer_id":14137448,"question_score":37,"reviewed":true} {"id":"so-14137353-p1","request":"Prepend '//' to the start of any line that includes the string 'myvar' to comment it out.","command":"sed 's/\\(^.*myvar.*$\\)/\\/\\/\\1/'","input_text":"class hw {\npublic static void main(String[] args) {\nSystem.out.println(\"Hello World!\");\nmyvar=1\n}\n}","expected_output":"class hw {\npublic static void main(String[] args) {\nSystem.out.println(\"Hello World!\");\n//myvar=1\n}\n}","validation_input":"int x = 0;\nmyvar++;\n// myvar is here\nint y = myvar + 1;","validation_output":"int x = 0;\n//myvar++;\n//// myvar is here\n//int y = myvar + 1;","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14137353/using-sed-to-replace-beginning-of-line-when-match-found","question_title":"Using sed to replace beginning of line when match found","question_owner":"dublintech","answer_owner":"Chris Seymour","answer_id":14137448,"question_score":37,"reviewed":true,"paraphrase_of":"so-14137353","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-14840953","request":"Remove the trailing comma from the end of each line in the input text.","command":"sed 's/,$//'","input_text":"SUPPLIER_PROC_ID BIGINT NOT NULL,\nBTCH_NBR INTEGER NOT NULL,\nRX_BTCH_SUPPLIER_SEQ_NBR INTEGER NOT NULL,","expected_output":"SUPPLIER_PROC_ID BIGINT NOT NULL\nBTCH_NBR INTEGER NOT NULL\nRX_BTCH_SUPPLIER_SEQ_NBR INTEGER NOT NULL","validation_input":"DATA_TYP_CD BYTEINT NOT NULL,\nDATA_PD_CD BYTEINT NOT NULL,","validation_output":"DATA_TYP_CD BYTEINT NOT NULL\nDATA_PD_CD BYTEINT NOT NULL","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14840953/how-to-remove-a-character-at-the-end-of-each-line-in-unix","question_title":"How to remove a character at the end of each line in UNIX","question_owner":"Teja","answer_owner":"jlliagre","answer_id":14840982,"question_score":67,"reviewed":true} {"id":"so-14840953-p1","request":"Strip the trailing comma from the end of every line in the provided text.","command":"sed 's/,$//'","input_text":"SUPPLIER_PROC_ID BIGINT NOT NULL,\nBTCH_NBR INTEGER NOT NULL,\nRX_BTCH_SUPPLIER_SEQ_NBR INTEGER NOT NULL,","expected_output":"SUPPLIER_PROC_ID BIGINT NOT NULL\nBTCH_NBR INTEGER NOT NULL\nRX_BTCH_SUPPLIER_SEQ_NBR INTEGER NOT NULL","validation_input":"DATA_TYP_CD BYTEINT NOT NULL,\nDATA_PD_CD BYTEINT NOT NULL,","validation_output":"DATA_TYP_CD BYTEINT NOT NULL\nDATA_PD_CD BYTEINT NOT NULL","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/14840953/how-to-remove-a-character-at-the-end-of-each-line-in-unix","question_title":"How to remove a character at the end of each line in UNIX","question_owner":"Teja","answer_owner":"jlliagre","answer_id":14840982,"question_score":67,"reviewed":true,"paraphrase_of":"so-14840953","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-1513861","request":"Join every pair of consecutive lines into a single line separated by a space.","command":"sed '$!N;s/\\n/ /'","input_text":"192.168.1.1\nhostname1\n192.168.1.2\nhostname2\n192.168.1.3\nhostname3","expected_output":"192.168.1.1 hostname1\n192.168.1.2 hostname2\n192.168.1.3 hostname3","validation_input":"line1\nline2\nline3\nline4","validation_output":"line1 line2\nline3 line4","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1513861/how-do-i-pair-every-two-lines-of-a-text-file-with-bash","question_title":"How do I pair every two lines of a text file with Bash?","question_owner":"fwaechter","answer_owner":"Tim","answer_id":1513918,"question_score":51,"reviewed":true} {"id":"so-1513861-p1","request":"Merge each pair of adjacent lines into a single line, using a space as the separator.","command":"sed '$!N;s/\\n/ /'","input_text":"192.168.1.1\nhostname1\n192.168.1.2\nhostname2\n192.168.1.3\nhostname3","expected_output":"192.168.1.1 hostname1\n192.168.1.2 hostname2\n192.168.1.3 hostname3","validation_input":"line1\nline2\nline3\nline4","validation_output":"line1 line2\nline3 line4","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1513861/how-do-i-pair-every-two-lines-of-a-text-file-with-bash","question_title":"How do I pair every two lines of a text file with Bash?","question_owner":"fwaechter","answer_owner":"Tim","answer_id":1513918,"question_score":51,"reviewed":true,"paraphrase_of":"so-1513861","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-1538676","request":"Capitalize the first letter of every word in each line.","command":"sed -e \"s/\\b\\(.\\)/\\u\\1/g\"","input_text":"Trouble me\nGold rush brides","expected_output":"Trouble Me\nGold Rush Brides","validation_input":"hello world\nfoo bar baz","validation_output":"Hello World\nFoo Bar Baz","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1538676/uppercasing-first-letter-of-words-using-sed","question_title":"Uppercasing First Letter of Words Using SED","question_owner":"neversaint","answer_owner":"tangens","answer_id":1538818,"question_score":72,"reviewed":true} {"id":"so-1538676-p1","request":"Convert the first character of every word in each line to uppercase.","command":"sed -e \"s/\\b\\(.\\)/\\u\\1/g\"","input_text":"Trouble me\nGold rush brides","expected_output":"Trouble Me\nGold Rush Brides","validation_input":"hello world\nfoo bar baz","validation_output":"Hello World\nFoo Bar Baz","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1538676/uppercasing-first-letter-of-words-using-sed","question_title":"Uppercasing First Letter of Words Using SED","question_owner":"neversaint","answer_owner":"tangens","answer_id":1538818,"question_score":72,"reviewed":true,"paraphrase_of":"so-1538676","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-16154007","request":"Replace all double quotes with single quotes in the input text.","command":"sed \"s/\\\"/'/g\"","input_text":"here","expected_output":"here","validation_input":"echo \"test \\\"quoted\\\" value\"","validation_output":"echo 'test \\'quoted\\' value'","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/16154007/replace-all-double-quotes-with-single-quotes","question_title":"Replace all double quotes with single quotes","question_owner":"Zounadire","answer_owner":"user142162","answer_id":16154029,"question_score":66,"reviewed":true} {"id":"so-16154007-p1","request":"Substitute all double quote characters with single quotes throughout the input.","command":"sed \"s/\\\"/'/g\"","input_text":"here","expected_output":"here","validation_input":"echo \"test \\\"quoted\\\" value\"","validation_output":"echo 'test \\'quoted\\' value'","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/16154007/replace-all-double-quotes-with-single-quotes","question_title":"Replace all double quotes with single quotes","question_owner":"Zounadire","answer_owner":"user142162","answer_id":16154029,"question_score":66,"reviewed":true,"paraphrase_of":"so-16154007","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-16715373","request":"Insert the text 'Hello world!!' immediately after any line containing the pattern ''.","command":"sed '// a\\Hello world!!'","input_text":"\n\n\n\n\n","expected_output":"\n\n\nHello world!!\n\n\n","validation_input":"\n\nclose\n","validation_output":"\n\nHello world!!\nclose\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/16715373/insert-contents-of-a-file-after-specific-pattern-match","question_title":"Insert contents of a file after specific pattern match","question_owner":"Satish","answer_owner":"Birei","answer_id":16715488,"question_score":34,"reviewed":true} {"id":"so-16715373-p1","request":"Add the string 'Hello world!!' on a new line immediately following any line that matches the pattern ''.","command":"sed '// a\\Hello world!!'","input_text":"\n\n\n\n\n","expected_output":"\n\n\nHello world!!\n\n\n","validation_input":"\n\nclose\n","validation_output":"\n\nHello world!!\nclose\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/16715373/insert-contents-of-a-file-after-specific-pattern-match","question_title":"Insert contents of a file after specific pattern match","question_owner":"Satish","answer_owner":"Birei","answer_id":16715488,"question_score":34,"reviewed":true,"paraphrase_of":"so-16715373","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-1733692","request":"Extract only the numeric digits found between 'abc' and 'xyz' on each line, printing nothing for lines that do not match.","command":"sed -n 's/^.*abc\\([0-9][0-9]*\\)xyz.*$/\\1/p'","input_text":"a\nb\nc\nabc12345xyz\na\nb\nc","expected_output":"12345\n","validation_input":"no match here\nabc9xyz\nabcxyz","validation_output":"9\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1733692/how-to-use-sed-awk-or-gawk-to-print-only-what-is-matched","question_title":"how to use sed, awk, or gawk to print only what is matched?","question_owner":"Stéphane","answer_owner":"mouviciel","answer_id":1733727,"question_score":102,"reviewed":true} {"id":"so-1733692-p1","request":"For each line, extract and print only the digits located between 'abc' and 'xyz'; output nothing for non-matching lines.","command":"sed -n 's/^.*abc\\([0-9][0-9]*\\)xyz.*$/\\1/p'","input_text":"a\nb\nc\nabc12345xyz\na\nb\nc","expected_output":"12345\n","validation_input":"no match here\nabc9xyz\nabcxyz","validation_output":"9\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1733692/how-to-use-sed-awk-or-gawk-to-print-only-what-is-matched","question_title":"how to use sed, awk, or gawk to print only what is matched?","question_owner":"Stéphane","answer_owner":"mouviciel","answer_id":1733727,"question_score":102,"reviewed":true,"paraphrase_of":"so-1733692","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-17364951","request":"Delete all lines from the beginning of the input up to and including the first line that matches the pattern '^bin$'. If the first line matches, only that line should be deleted.","command":"sed '0,/^bin$/d'","input_text":"bin\nboot\ndev\netc\nhome","expected_output":"boot\ndev\netc\nhome","validation_input":"aaa\nbin\nboot\nccc","validation_output":"boot\nccc","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/17364951/remove-all-lines-before-a-match-with-sed","question_title":"Remove all lines before a match with sed","question_owner":"Fabio","answer_owner":"Endoro","answer_id":17365103,"question_score":69,"reviewed":true} {"id":"so-17364951-p1","request":"Remove all lines from the start of the input through the first line matching the pattern '^bin$', inclusive.","command":"sed '0,/^bin$/d'","input_text":"bin\nboot\ndev\netc\nhome","expected_output":"boot\ndev\netc\nhome","validation_input":"aaa\nbin\nboot\nccc","validation_output":"boot\nccc","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/17364951/remove-all-lines-before-a-match-with-sed","question_title":"Remove all lines before a match with sed","question_owner":"Fabio","answer_owner":"Endoro","answer_id":17365103,"question_score":69,"reviewed":true,"paraphrase_of":"so-17364951","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-1797906","request":"Delete lines containing the string 'timebomb' from the input text using a colon as the delimiter for the address pattern.","command":"sed '\\:timebomb:d'","input_text":"00 30 * * * /opt/timebomb.sh >> timebomb.log\n01 30 * * * /opt/reincarnate.sh >> reincarnation.log","expected_output":"01 30 * * * /opt/reincarnate.sh >> reincarnation.log","validation_input":"keep this line\ndelete timebomb here\nanother keeper","validation_output":"keep this line\nanother keeper","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1797906/delete-using-a-different-delimiter-with-sed","question_title":"Delete using a different delimiter with Sed","question_owner":"calvinkrishy","answer_owner":"Stobor","answer_id":1797967,"question_score":44,"reviewed":true} {"id":"so-1797906-p1","request":"Use a colon as the address delimiter to remove any lines containing the string 'timebomb'.","command":"sed '\\:timebomb:d'","input_text":"00 30 * * * /opt/timebomb.sh >> timebomb.log\n01 30 * * * /opt/reincarnate.sh >> reincarnation.log","expected_output":"01 30 * * * /opt/reincarnate.sh >> reincarnation.log","validation_input":"keep this line\ndelete timebomb here\nanother keeper","validation_output":"keep this line\nanother keeper","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1797906/delete-using-a-different-delimiter-with-sed","question_title":"Delete using a different delimiter with Sed","question_owner":"calvinkrishy","answer_owner":"Stobor","answer_id":1797967,"question_score":44,"reviewed":true,"paraphrase_of":"so-1797906","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-17998763","request":"Comment out lines containing the string 'BBB' by prepending a '#' character, but only if the line does not already start with a '#'.","command":"sed -e '/BBB/ s/^#*/#/'","input_text":"AAA\nBBB\nCCC","expected_output":"AAA\n#BBB\nCCC","validation_input":"# BBB\nBBB\n# Already commented BBB","validation_output":"# BBB\n#BBB\n# Already commented BBB","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/17998763/sed-commenting-a-line-matching-a-specific-string-and-that-is-not-already-comme","question_title":"sed - Commenting a line matching a specific string AND that is not already commented out","question_owner":"Jean-Francois Chevrette","answer_owner":"aragaer","answer_id":17999003,"question_score":98,"reviewed":true} {"id":"so-17998763-p1","request":"Prepend '#' to lines containing 'BBB' to comment them out, but skip lines that already begin with '#'.","command":"sed -e '/BBB/ s/^#*/#/'","input_text":"AAA\nBBB\nCCC","expected_output":"AAA\n#BBB\nCCC","validation_input":"# BBB\nBBB\n# Already commented BBB","validation_output":"# BBB\n#BBB\n# Already commented BBB","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/17998763/sed-commenting-a-line-matching-a-specific-string-and-that-is-not-already-comme","question_title":"sed - Commenting a line matching a specific string AND that is not already commented out","question_owner":"Jean-Francois Chevrette","answer_owner":"aragaer","answer_id":17999003,"question_score":98,"reviewed":true,"paraphrase_of":"so-17998763","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-18166552","request":"Delete all lines from the beginning of the input up to and including the first line that contains the string 'yahoo'.","command":"sed '1,/yahoo/d'","input_text":"http://www.google.com\nhttp://www.bing.com\nhttp://www.yahoo.com\nhttp://www.baidu.com\nhttp://www.yandex.com","expected_output":"http://www.baidu.com\nhttp://www.yandex.com","validation_input":"alpha\nbeta\ngamma yahoo delta\nepsilon\nzeta","validation_output":"epsilon\nzeta","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/18166552/grep-a-print-everything-after-a-match","question_title":"'grep +A': print everything after a match","question_owner":"B.Mr.W.","answer_owner":"Hai Vu","answer_id":18166628,"question_score":38,"reviewed":true} {"id":"so-18166552-p1","request":"Delete all lines from the beginning of the file up to and including the first line that contains 'yahoo'.","command":"sed '1,/yahoo/d'","input_text":"http://www.google.com\nhttp://www.bing.com\nhttp://www.yahoo.com\nhttp://www.baidu.com\nhttp://www.yandex.com","expected_output":"http://www.baidu.com\nhttp://www.yandex.com","validation_input":"alpha\nbeta\ngamma yahoo delta\nepsilon\nzeta","validation_output":"epsilon\nzeta","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/18166552/grep-a-print-everything-after-a-match","question_title":"'grep +A': print everything after a match","question_owner":"B.Mr.W.","answer_owner":"Hai Vu","answer_id":18166628,"question_score":38,"reviewed":true,"paraphrase_of":"so-18166552","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-18234378","request":"Replace every occurrence of the colon character ':' with a newline character to split the string into multiple lines.","command":"sed 's/:/\\n/g'","input_text":"string1:string2:string3:string4:string5","expected_output":"string1\nstring2\nstring3\nstring4\nstring5","validation_input":"he:llo:you","validation_output":"he\nllo\nyou","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/18234378/using-sed-to-split-a-string-with-a-delimiter","question_title":"Using sed to split a string with a delimiter","question_owner":"nullByteMe","answer_owner":"fedorqui","answer_id":18234407,"question_score":69,"reviewed":true} {"id":"so-18234378-p1","request":"Replace every instance of ':' with a newline character to break the string into separate lines.","command":"sed 's/:/\\n/g'","input_text":"string1:string2:string3:string4:string5","expected_output":"string1\nstring2\nstring3\nstring4\nstring5","validation_input":"he:llo:you","validation_output":"he\nllo\nyou","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/18234378/using-sed-to-split-a-string-with-a-delimiter","question_title":"Using sed to split a string with a delimiter","question_owner":"nullByteMe","answer_owner":"fedorqui","answer_id":18234407,"question_score":69,"reviewed":true,"paraphrase_of":"so-18234378","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-18397698","request":"Extract the substring after the last colon character on each line.","command":"sed 's/.*://'","input_text":"server@10.200.200.20:/home/some/directory/file\nuser:host:path/to/file\nsimple:text","expected_output":"/home/some/directory/file\npath/to/file\ntext","validation_input":"key:value:extra\nno_colon_here\na:b:c:d","validation_output":"extra\nno_colon_here\nd","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/18397698/how-to-cut-a-string-after-a-specific-character-in-unix","question_title":"How to cut a string after a specific character in unix","question_owner":"canecse","answer_owner":"falsetru","answer_id":18397722,"question_score":41,"reviewed":true} {"id":"so-18397698-p1","request":"For every line, extract the text segment that follows the final colon.","command":"sed 's/.*://'","input_text":"server@10.200.200.20:/home/some/directory/file\nuser:host:path/to/file\nsimple:text","expected_output":"/home/some/directory/file\npath/to/file\ntext","validation_input":"key:value:extra\nno_colon_here\na:b:c:d","validation_output":"extra\nno_colon_here\nd","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/18397698/how-to-cut-a-string-after-a-specific-character-in-unix","question_title":"How to cut a string after a specific character in unix","question_owner":"canecse","answer_owner":"falsetru","answer_id":18397722,"question_score":41,"reviewed":true,"paraphrase_of":"so-18397698","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-1853009","request":"Replace every sequence of one or more space or tab characters with a newline character.","command":"sed -e 's/[[:blank:]]\\+/\\n/g'","input_text":"word1 word2\tword3\nalpha beta","expected_output":"word1\nword2\nword3\nalpha\nbeta","validation_input":"one two three","validation_output":"one\ntwo\nthree","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1853009/replace-all-whitespace-with-a-line-break-paragraph-mark-to-make-a-word-list","question_title":"Replace all whitespace with a line break/paragraph mark to make a word list","question_owner":"DavidR","answer_owner":"Greg Bacon","answer_id":1853040,"question_score":73,"reviewed":true} {"id":"so-1853009-p1","request":"Substitute any run of spaces or tabs with a newline character.","command":"sed -e 's/[[:blank:]]\\+/\\n/g'","input_text":"word1 word2\tword3\nalpha beta","expected_output":"word1\nword2\nword3\nalpha\nbeta","validation_input":"one two three","validation_output":"one\ntwo\nthree","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1853009/replace-all-whitespace-with-a-line-break-paragraph-mark-to-make-a-word-list","question_title":"Replace all whitespace with a line break/paragraph mark to make a word list","question_owner":"DavidR","answer_owner":"Greg Bacon","answer_id":1853040,"question_score":73,"reviewed":true,"paraphrase_of":"so-1853009","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-18620153","request":"Replace the line immediately following a line containing 'ConnectionString' with 'changed_value'.","command":"sed '/ConnectionString<\\/key>/!b;n;cchanged_value'","input_text":"OtherKey\nkeep_this\nConnectionString\nanything_could_be_here\nAnotherKey\nkeep_this_too","expected_output":"OtherKey\nkeep_this\nConnectionString\nchanged_value\nAnotherKey\nkeep_this_too","validation_input":"ConnectionString\nold_value\nOther\nval","validation_output":"ConnectionString\nchanged_value\nOther\nval","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/18620153/find-matching-text-and-replace-next-line","question_title":"find matching text and replace next line","question_owner":"bswinnerton","answer_owner":"potong","answer_id":18622953,"question_score":70,"reviewed":true} {"id":"so-18620153-p1","request":"If a line contains 'ConnectionString', replace the subsequent line with 'changed_value'.","command":"sed '/ConnectionString<\\/key>/!b;n;cchanged_value'","input_text":"OtherKey\nkeep_this\nConnectionString\nanything_could_be_here\nAnotherKey\nkeep_this_too","expected_output":"OtherKey\nkeep_this\nConnectionString\nchanged_value\nAnotherKey\nkeep_this_too","validation_input":"ConnectionString\nold_value\nOther\nval","validation_output":"ConnectionString\nchanged_value\nOther\nval","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/18620153/find-matching-text-and-replace-next-line","question_title":"find matching text and replace next line","question_owner":"bswinnerton","answer_owner":"potong","answer_id":18622953,"question_score":70,"reviewed":true,"paraphrase_of":"so-18620153","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-1898553","request":"Replace each line with its first sequence of digits; leave lines without digits unchanged.","command":"sed 's/[^0-9]*\\([0-9]\\+\\).*/\\1/'","input_text":"TestT100String\nNoDigitsHere\nPrefix42Suffix","expected_output":"100\nNoDigitsHere\n42","validation_input":"ABC123XYZ\n99Bottles\nTextOnly","validation_output":"123\n99\nTextOnly","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1898553/return-a-regex-match-in-a-bash-script-instead-of-replacing-it","question_title":"Return a regex match in a Bash script, instead of replacing it","question_owner":"Mint","answer_owner":"Dennis Williamson","answer_id":1898578,"question_score":34,"reviewed":true} {"id":"so-1898553-p1","request":"Replace each line with its initial sequence of digits, preserving lines that lack digits as they are.","command":"sed 's/[^0-9]*\\([0-9]\\+\\).*/\\1/'","input_text":"TestT100String\nNoDigitsHere\nPrefix42Suffix","expected_output":"100\nNoDigitsHere\n42","validation_input":"ABC123XYZ\n99Bottles\nTextOnly","validation_output":"123\n99\nTextOnly","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/1898553/return-a-regex-match-in-a-bash-script-instead-of-replacing-it","question_title":"Return a regex match in a Bash script, instead of replacing it","question_owner":"Mint","answer_owner":"Dennis Williamson","answer_id":1898578,"question_score":34,"reviewed":true,"paraphrase_of":"so-1898553","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-20521857","request":"Remove all trailing whitespace (spaces and tabs) from the end of each line.","command":"sed 's/[[:blank:]]*$//'","input_text":"hello \nbye\t \nha^I \nclean","expected_output":"hello\nbye\nha^I\nclean","validation_input":"test line \nanother\t","validation_output":"test line\nanother","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20521857/remove-white-space-from-the-end-of-line-in-linux","question_title":"remove white space from the end of line in linux","question_owner":"aksg24","answer_owner":"fedorqui","answer_id":20521915,"question_score":55,"reviewed":true} {"id":"so-20521857-p1","request":"Strip all trailing spaces and tabs from every line.","command":"sed 's/[[:blank:]]*$//'","input_text":"hello \nbye\t \nha^I \nclean","expected_output":"hello\nbye\nha^I\nclean","validation_input":"test line \nanother\t","validation_output":"test line\nanother","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20521857/remove-white-space-from-the-end-of-line-in-linux","question_title":"remove white space from the end of line in linux","question_owner":"aksg24","answer_owner":"fedorqui","answer_id":20521915,"question_score":55,"reviewed":true,"paraphrase_of":"so-20521857","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-20521857-v1","request":"Remove all trailing whitespace (spaces and tabs) from the end of each line.","command":"sed 's/[[:blank:]]*$//'","input_text":"data \nvalue\t\n clean \t\nend","expected_output":"data\nvalue\n clean\nend","validation_input":"alpha \nbeta\t \ngamma \ndelta","validation_output":"alpha\nbeta\ngamma\ndelta","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-input-variation","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20521857/remove-white-space-from-the-end-of-line-in-linux","question_title":"remove white space from the end of line in linux","question_owner":"aksg24","answer_owner":"fedorqui","answer_id":20521915,"question_score":55,"reviewed":true,"variation_of":"so-20521857","variation_model":"qwen/qwen3.7-plus"} {"id":"so-20521857-v1-p1","request":"Delete any whitespace consisting of spaces or tabs at the end of each line.","command":"sed 's/[[:blank:]]*$//'","input_text":"data \nvalue\t\n clean \t\nend","expected_output":"data\nvalue\n clean\nend","validation_input":"alpha \nbeta\t \ngamma \ndelta","validation_output":"alpha\nbeta\ngamma\ndelta","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20521857/remove-white-space-from-the-end-of-line-in-linux","question_title":"remove white space from the end of line in linux","question_owner":"aksg24","answer_owner":"fedorqui","answer_id":20521915,"question_score":55,"reviewed":true,"variation_of":"so-20521857","variation_model":"qwen/qwen3.7-plus","paraphrase_of":"so-20521857-v1","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-20871534","request":"Join all lines of input into a single line, replacing newlines with a single space.","command":"sed ':a;N;s/\\n/ /;ba'","input_text":"The quick\nbrown fox","expected_output":"The quick brown fox","validation_input":"Hello\nWorld\nTest","validation_output":"Hello World Test","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20871534/concatenate-in-bash-the-output-of-two-commands-without-newline-character","question_title":"Concatenate in bash the output of two commands without newline character","question_owner":"synaptik","answer_owner":"anubhava","answer_id":20871567,"question_score":77,"reviewed":true} {"id":"so-20871534-p1","request":"Merge all input lines into one continuous line by substituting newlines with a single space.","command":"sed ':a;N;s/\\n/ /;ba'","input_text":"The quick\nbrown fox","expected_output":"The quick brown fox","validation_input":"Hello\nWorld\nTest","validation_output":"Hello World Test","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20871534/concatenate-in-bash-the-output-of-two-commands-without-newline-character","question_title":"Concatenate in bash the output of two commands without newline character","question_owner":"synaptik","answer_owner":"anubhava","answer_id":20871567,"question_score":77,"reviewed":true,"paraphrase_of":"so-20871534","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-20871534-v1","request":"Join all lines of input into a single line, replacing newlines with a single space.","command":"sed ':a;N;s/\\n/ /;ba'","input_text":"Hello\nWorld\nFoo\nBar","expected_output":"Hello World Foo Bar","validation_input":"One\nTwo\nThree","validation_output":"One Two Three","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-input-variation","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20871534/concatenate-in-bash-the-output-of-two-commands-without-newline-character","question_title":"Concatenate in bash the output of two commands without newline character","question_owner":"synaptik","answer_owner":"anubhava","answer_id":20871567,"question_score":77,"reviewed":true,"variation_of":"so-20871534","variation_model":"qwen/qwen3.7-plus"} {"id":"so-20871534-v1-p1","request":"Combine all lines into a single string, using a space in place of each newline.","command":"sed ':a;N;s/\\n/ /;ba'","input_text":"Hello\nWorld\nFoo\nBar","expected_output":"Hello World Foo Bar","validation_input":"One\nTwo\nThree","validation_output":"One Two Three","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20871534/concatenate-in-bash-the-output-of-two-commands-without-newline-character","question_title":"Concatenate in bash the output of two commands without newline character","question_owner":"synaptik","answer_owner":"anubhava","answer_id":20871567,"question_score":77,"reviewed":true,"variation_of":"so-20871534","variation_model":"qwen/qwen3.7-plus","paraphrase_of":"so-20871534-v1","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-20943025","request":"Print lines starting from the first occurrence of 'trigger' up to and including the second occurrence of 'trigger', then stop processing.","command":"sed -n '/trigger/{p; :loop n; p; /trigger/q; b loop}'","input_text":"header\ntrigger\ntext1\ntext2\ntrigger\ntext5\ntrigger","expected_output":"trigger\ntext1\ntext2\ntrigger\n","validation_input":"start\ntrigger\nline A\nline B\ntrigger\nend","validation_output":"trigger\nline A\nline B\ntrigger\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20943025/how-can-i-get-sed-to-quit-after-the-first-matching-address-range","question_title":"how can I get sed to quit after the first matching address range?","question_owner":"PonyEars","answer_owner":"janos","answer_id":20943542,"question_score":38,"reviewed":true} {"id":"so-20943025-p1","request":"Output lines beginning with the first instance of 'trigger' through the second instance of 'trigger', inclusive, then halt.","command":"sed -n '/trigger/{p; :loop n; p; /trigger/q; b loop}'","input_text":"header\ntrigger\ntext1\ntext2\ntrigger\ntext5\ntrigger","expected_output":"trigger\ntext1\ntext2\ntrigger\n","validation_input":"start\ntrigger\nline A\nline B\ntrigger\nend","validation_output":"trigger\nline A\nline B\ntrigger\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20943025/how-can-i-get-sed-to-quit-after-the-first-matching-address-range","question_title":"how can I get sed to quit after the first matching address range?","question_owner":"PonyEars","answer_owner":"janos","answer_id":20943542,"question_score":38,"reviewed":true,"paraphrase_of":"so-20943025","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-20943025-v1","request":"Print lines starting from the first occurrence of 'trigger' up to and including the second occurrence of 'trigger', then stop processing.","command":"sed -n '/trigger/{p; :loop n; p; /trigger/q; b loop}'","input_text":"start\ntrigger\nmiddle1\nmiddle2\ntrigger\nend","expected_output":"trigger\nmiddle1\nmiddle2\ntrigger\n","validation_input":"pre\ntrigger\nlineA\nlineB\ntrigger\npost","validation_output":"trigger\nlineA\nlineB\ntrigger\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-input-variation","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20943025/how-can-i-get-sed-to-quit-after-the-first-matching-address-range","question_title":"how can I get sed to quit after the first matching address range?","question_owner":"PonyEars","answer_owner":"janos","answer_id":20943542,"question_score":38,"reviewed":true,"variation_of":"so-20943025","variation_model":"qwen/qwen3.7-plus"} {"id":"so-20943025-v1-p1","request":"Start printing at the first appearance of 'trigger' and continue until the second appearance is included, then cease processing.","command":"sed -n '/trigger/{p; :loop n; p; /trigger/q; b loop}'","input_text":"start\ntrigger\nmiddle1\nmiddle2\ntrigger\nend","expected_output":"trigger\nmiddle1\nmiddle2\ntrigger\n","validation_input":"pre\ntrigger\nlineA\nlineB\ntrigger\npost","validation_output":"trigger\nlineA\nlineB\ntrigger\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/20943025/how-can-i-get-sed-to-quit-after-the-first-matching-address-range","question_title":"how can I get sed to quit after the first matching address range?","question_owner":"PonyEars","answer_owner":"janos","answer_id":20943542,"question_score":38,"reviewed":true,"variation_of":"so-20943025","variation_model":"qwen/qwen3.7-plus","paraphrase_of":"so-20943025-v1","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-21309020","request":"Remove all odd-numbered lines from the input text, keeping only the even-numbered lines.","command":"sed '1d; n; d'","input_text":"Line 1\nLine 2\nLine 3\nLine 4","expected_output":"Line 2\nLine 4","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,"reviewed":true} {"id":"so-21309020-p1","request":"Filter out all odd-numbered lines, retaining only those at even positions.","command":"sed '1d; n; d'","input_text":"Line 1\nLine 2\nLine 3\nLine 4","expected_output":"Line 2\nLine 4","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,"reviewed":true,"paraphrase_of":"so-21309020","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-21309020-v1","request":"Remove all odd-numbered lines from the input text, keeping only the even-numbered lines.","command":"sed '1d; n; d'","input_text":"A\nB\nC\nD\nE\nF","expected_output":"B\nD\nF","validation_input":"1\n2\n3\n4\n5\n6","validation_output":"2\n4\n6","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-input-variation","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,"reviewed":true,"variation_of":"so-21309020","variation_model":"qwen/qwen3.7-plus"} {"id":"so-21309020-v1-p1","request":"Discard lines at odd indices, keeping only the even-numbered lines.","command":"sed '1d; n; d'","input_text":"A\nB\nC\nD\nE\nF","expected_output":"B\nD\nF","validation_input":"1\n2\n3\n4\n5\n6","validation_output":"2\n4\n6","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,"reviewed":true,"variation_of":"so-21309020","variation_model":"qwen/qwen3.7-plus","paraphrase_of":"so-21309020-v1","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-2157288","request":"Delete any line containing the pattern 'pattern' case-insensitively.","command":"sed '/pattern/Id'","input_text":"Keep this\nRemove Pattern here\nKeep this too\nremove PATTERN now","expected_output":"Keep this\nKeep this too\n","validation_input":"Case Sensitive Line\nIgnore pattern match\nAnother Line","validation_output":"Case Sensitive Line\nAnother Line","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2157288/using-sed-to-delete-a-case-insensitive-matched-line","question_title":"Using sed to delete a case insensitive matched line","question_owner":"eruina","answer_owner":"Mark Byers","answer_id":2157363,"question_score":48,"reviewed":true} {"id":"so-2157288-p1","request":"Filter out any line that matches the case-insensitive pattern 'pattern'.","command":"sed '/pattern/Id'","input_text":"Keep this\nRemove Pattern here\nKeep this too\nremove PATTERN now","expected_output":"Keep this\nKeep this too\n","validation_input":"Case Sensitive Line\nIgnore pattern match\nAnother Line","validation_output":"Case Sensitive Line\nAnother Line","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2157288/using-sed-to-delete-a-case-insensitive-matched-line","question_title":"Using sed to delete a case insensitive matched line","question_owner":"eruina","answer_owner":"Mark Byers","answer_id":2157363,"question_score":48,"reviewed":true,"paraphrase_of":"so-2157288","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-22497246","request":"Insert the lines 'line1', 'line2', 'line3', and 'line4' after every line containing the pattern 'cdef'.","command":"sed '/cdef/a\\line1\\nline2\\nline3\\nline4'","input_text":"abcd\naccd\ncdef\nline\nweb","expected_output":"abcd\naccd\ncdef\nline1\nline2\nline3\nline4\nline\nweb","validation_input":"start\ncdef\nend","validation_output":"start\ncdef\nline1\nline2\nline3\nline4\nend","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/22497246/insert-multiple-lines-into-a-file-after-specified-pattern-using-shell-script","question_title":"Insert multiple lines into a file after specified pattern using shell script","question_owner":"user27","answer_owner":"sat","answer_id":22497499,"question_score":102,"reviewed":true} {"id":"so-22497246-p1","request":"After each line containing 'cdef', insert the lines 'line1', 'line2', 'line3', and 'line4'.","command":"sed '/cdef/a\\line1\\nline2\\nline3\\nline4'","input_text":"abcd\naccd\ncdef\nline\nweb","expected_output":"abcd\naccd\ncdef\nline1\nline2\nline3\nline4\nline\nweb","validation_input":"start\ncdef\nend","validation_output":"start\ncdef\nline1\nline2\nline3\nline4\nend","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/22497246/insert-multiple-lines-into-a-file-after-specified-pattern-using-shell-script","question_title":"Insert multiple lines into a file after specified pattern using shell script","question_owner":"user27","answer_owner":"sat","answer_id":22497499,"question_score":102,"reviewed":true,"paraphrase_of":"so-22497246","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-2310605","request":"Remove all leading whitespace (spaces and tabs) from each line of the input text.","command":"sed 's/^[ \\t]*//'","input_text":" for (i = 0; i < 100; i++)\n\tfor (i = 0; i < 100; i++)\n 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++)","validation_input":"\t\tindented line\n mixed spaces and tabs\nno indent","validation_output":"indented line\nmixed spaces and tabs\nno indent","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,"reviewed":true} {"id":"so-2310605-p1","request":"Strip all leading spaces and tabs from every line in the input.","command":"sed 's/^[ \\t]*//'","input_text":" for (i = 0; i < 100; i++)\n\tfor (i = 0; i < 100; i++)\n 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++)","validation_input":"\t\tindented line\n mixed spaces and tabs\nno indent","validation_output":"indented line\nmixed spaces and tabs\nno indent","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,"reviewed":true,"paraphrase_of":"so-2310605","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-2369314","request":"Replace every backslash character with a forward slash in the input text.","command":"sed 's/\\\\/\\//g'","input_text":"sample_input\\whatever","expected_output":"sample_input/whatever","validation_input":"path\\to\\file","validation_output":"path/to/file","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2369314/why-does-sed-require-3-backslashes-for-a-regular-backslash","question_title":"Why does sed require 3 backslashes for a regular backslash?","question_owner":"Geo","answer_owner":"Dennis Williamson","answer_id":2372693,"question_score":56,"reviewed":true} {"id":"so-2369314-p1","request":"Substitute every backslash with a forward slash throughout the text.","command":"sed 's/\\\\/\\//g'","input_text":"sample_input\\whatever","expected_output":"sample_input/whatever","validation_input":"path\\to\\file","validation_output":"path/to/file","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2369314/why-does-sed-require-3-backslashes-for-a-regular-backslash","question_title":"Why does sed require 3 backslashes for a regular backslash?","question_owner":"Geo","answer_owner":"Dennis Williamson","answer_id":2372693,"question_score":56,"reviewed":true,"paraphrase_of":"so-2369314","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-24230117","request":"Prepend a '#' character to the beginning of any line that contains the pattern '000'.","command":"sed 's/.*000/#&/'","input_text":"This is a 000 line.\nThis is 000 yet ano000ther line.\nThis is still yet another line.","expected_output":"#This is a 000 line.\n#This is 000 yet ano000ther line.\nThis is still yet another line.","validation_input":"no match here\nmatch 000 here\nanother 000 test","validation_output":"no match here\n#match 000 here\n#another 000 test","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/24230117/how-to-add-a-before-any-line-containing-a-matching-pattern-in-bash","question_title":"How to add a # before any line containing a matching pattern in BASH?","question_owner":"Village","answer_owner":"potong","answer_id":24233771,"question_score":37,"reviewed":true} {"id":"so-24889346","request":"Uncomment lines that start with a hash symbol and contain the string ' 2001 ' by removing the leading hash symbol.","command":"sed '/^#.* 2001 /s/^#//'","input_text":"#-A INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT\n-A INPUT -m state --state NEW -m tcp -p tcp --dport 2002 -j ACCEPT","expected_output":"-A INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT\n-A INPUT -m state --state NEW -m tcp -p tcp --dport 2002 -j ACCEPT","validation_input":"# Commented line with 2001 \n# Another comment\nActive line with 2001 here","validation_output":" Commented line with 2001 \n# Another comment\nActive line with 2001 here","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/24889346/how-to-uncomment-a-line-that-contains-a-specific-string-using-sed","question_title":"How to UNCOMMENT a line that contains a specific string using Sed?","question_owner":"user3864928","answer_owner":"Avinash Raj","answer_id":24889374,"question_score":80,"reviewed":true} {"id":"so-24889346-p1","request":"Uncomment lines beginning with a hash that include ' 2001 ' by stripping the leading '#'.","command":"sed '/^#.* 2001 /s/^#//'","input_text":"#-A INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT\n-A INPUT -m state --state NEW -m tcp -p tcp --dport 2002 -j ACCEPT","expected_output":"-A INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT\n-A INPUT -m state --state NEW -m tcp -p tcp --dport 2002 -j ACCEPT","validation_input":"# Commented line with 2001 \n# Another comment\nActive line with 2001 here","validation_output":" Commented line with 2001 \n# Another comment\nActive line with 2001 here","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/24889346/how-to-uncomment-a-line-that-contains-a-specific-string-using-sed","question_title":"How to UNCOMMENT a line that contains a specific string using Sed?","question_owner":"user3864928","answer_owner":"Avinash Raj","answer_id":24889374,"question_score":80,"reviewed":true,"paraphrase_of":"so-24889346","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-2560411","request":"Remove every odd-numbered line from the input text, keeping only the even-numbered lines.","command":"sed '1~2d'","input_text":"remove\nkeep\nremove\nkeep\nremove","expected_output":"keep\nkeep\n","validation_input":"line1\nline2\nline3\nline4","validation_output":"line2\nline4","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2560411/how-to-remove-every-other-line-with-sed","question_title":"How to remove every other line with sed?","question_owner":"hhh","answer_owner":"ghostdog74","answer_id":2560448,"question_score":64,"reviewed":true} {"id":"so-2560411-p1","request":"Discard all odd-numbered lines, retaining only the even-numbered ones.","command":"sed '1~2d'","input_text":"remove\nkeep\nremove\nkeep\nremove","expected_output":"keep\nkeep\n","validation_input":"line1\nline2\nline3\nline4","validation_output":"line2\nline4","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2560411/how-to-remove-every-other-line-with-sed","question_title":"How to remove every other line with sed?","question_owner":"hhh","answer_owner":"ghostdog74","answer_id":2560448,"question_score":64,"reviewed":true,"paraphrase_of":"so-2560411","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-26081375","request":"Delete lines containing 'This' within the line range 3 to 6, ensuring POSIX compatibility with a semicolon.","command":"sed -e '3,6 { /This/d; }'","input_text":"This is my cat\nmy cat's name is betty\nThis is your dog\nyour dog's name is frank\nThis is your fish\nyour fish's name is george\nThis is my goat\nmy goat's name is adam","expected_output":"This is my cat\nmy cat's name is betty\nyour dog's name is frank\nyour fish's name is george\nThis is my goat\nmy goat's name is adam","validation_input":"Line 1\nLine 2\nThis is line 3\nLine 4\nThis is line 5\nLine 6\nLine 7","validation_output":"Line 1\nLine 2\nLine 4\nLine 6\nLine 7","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/26081375/bsd-sed-extra-characters-at-the-end-of-d-command","question_title":"BSD sed: extra characters at the end of d command","question_owner":"lutaoact","answer_owner":"Jonathan Leffler","answer_id":26081763,"question_score":52,"reviewed":true} {"id":"so-26081375-p1","request":"Within lines 3 through 6, delete those containing 'This', using a semicolon for POSIX compliance.","command":"sed -e '3,6 { /This/d; }'","input_text":"This is my cat\nmy cat's name is betty\nThis is your dog\nyour dog's name is frank\nThis is your fish\nyour fish's name is george\nThis is my goat\nmy goat's name is adam","expected_output":"This is my cat\nmy cat's name is betty\nyour dog's name is frank\nyour fish's name is george\nThis is my goat\nmy goat's name is adam","validation_input":"Line 1\nLine 2\nThis is line 3\nLine 4\nThis is line 5\nLine 6\nLine 7","validation_output":"Line 1\nLine 2\nLine 4\nLine 6\nLine 7","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/26081375/bsd-sed-extra-characters-at-the-end-of-d-command","question_title":"BSD sed: extra characters at the end of d command","question_owner":"lutaoact","answer_owner":"Jonathan Leffler","answer_id":26081763,"question_score":52,"reviewed":true,"paraphrase_of":"so-26081375","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-2652494","request":"Extract the first column from a comma-separated values stream, removing everything after the first comma on each line.","command":"sed 's/,.*//'","input_text":"EXAMPLEfoo,60,6\nEXAMPLEbar,30,6\nEXAMPLE1,60,3","expected_output":"EXAMPLEfoo\nEXAMPLEbar\nEXAMPLE1","validation_input":"Name,Value,Extra\nTest,123,abc","validation_output":"Name\nTest","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2652494/parsing-the-first-column-of-a-csv-file-to-a-new-file","question_title":"Parsing the first column of a csv file to a new file","question_owner":"S1syphus","answer_owner":"Thomas","answer_id":2652526,"question_score":50,"reviewed":true} {"id":"so-2652494-p1","request":"From a CSV stream, keep only the first column by truncating each line at the first comma.","command":"sed 's/,.*//'","input_text":"EXAMPLEfoo,60,6\nEXAMPLEbar,30,6\nEXAMPLE1,60,3","expected_output":"EXAMPLEfoo\nEXAMPLEbar\nEXAMPLE1","validation_input":"Name,Value,Extra\nTest,123,abc","validation_output":"Name\nTest","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/2652494/parsing-the-first-column-of-a-csv-file-to-a-new-file","question_title":"Parsing the first column of a csv file to a new file","question_owner":"S1syphus","answer_owner":"Thomas","answer_id":2652526,"question_score":50,"reviewed":true,"paraphrase_of":"so-2652494","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-27305177","request":"Remove the last character from the last line of the input stream.","command":"sed '$ s/.$//'","input_text":"sometext\nmoretext\nlastline","expected_output":"sometext\nmoretext\nlastlin","validation_input":"line one\nline two","validation_output":"line one\nline tw","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/27305177/how-can-i-remove-the-last-non-newline-character-of-a-file-in-unix","question_title":"How can I remove the last (non-newline) character of a file in unix?","question_owner":"MaxPRafferty","answer_owner":"mklement0","answer_id":27327973,"question_score":101,"reviewed":true} {"id":"so-27305177-p1","request":"Delete the final character of the last line in the input stream.","command":"sed '$ s/.$//'","input_text":"sometext\nmoretext\nlastline","expected_output":"sometext\nmoretext\nlastlin","validation_input":"line one\nline two","validation_output":"line one\nline tw","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/27305177/how-can-i-remove-the-last-non-newline-character-of-a-file-in-unix","question_title":"How can I remove the last (non-newline) character of a file in unix?","question_owner":"MaxPRafferty","answer_owner":"mklement0","answer_id":27327973,"question_score":101,"reviewed":true,"paraphrase_of":"so-27305177","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-2957094","request":"Print only lines whose first two whitespace-separated fields are a number and a value starting with 'LINUX'.","command":"sed -n -e '/^[0-9][0-9]* LINUX/p'","input_text":"1 LINUX param1 value1\n2 LINUXparam2 value2\n3 SOLARIS param3 value3\n4 SOLARIS param4 value4","expected_output":"1 LINUX param1 value1\n2 LINUXparam2 value2\n","validation_input":"10 LINUX test\n5 UNIX test\n123 LINUX foo","validation_output":"10 LINUX test\n123 LINUX foo","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,"reviewed":true} {"id":"so-2957094-p1","request":"Output only lines where the first two whitespace-delimited fields consist of a number and a value starting with 'LINUX'.","command":"sed -n -e '/^[0-9][0-9]* LINUX/p'","input_text":"1 LINUX param1 value1\n2 LINUXparam2 value2\n3 SOLARIS param3 value3\n4 SOLARIS param4 value4","expected_output":"1 LINUX param1 value1\n2 LINUXparam2 value2\n","validation_input":"10 LINUX test\n5 UNIX test\n123 LINUX foo","validation_output":"10 LINUX test\n123 LINUX foo","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,"reviewed":true,"paraphrase_of":"so-2957094","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-29613304","request":"Escape all regex metacharacters in the input string so it can be used as a literal search pattern. Use the technique of placing every character except caret into its own character class, and escaping carets.","command":"sed 's/[^^]/[&]/g; s/\\^/\\\\^/g'","input_text":"[a-z]\\+","expected_output":"[[][a][-][z][]][\\][+]","validation_input":"^test$.*","validation_output":"\\^[t][e][s][t][$][.][*]","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed","question_title":"Is it possible to escape regex metacharacters reliably with sed","question_owner":"hek2mgl","answer_owner":"mklement0","answer_id":29613573,"question_score":91,"reviewed":true} {"id":"so-29613304-p1","request":"Sanitize the input string for literal regex usage by wrapping non-caret characters in individual character classes and escaping carets.","command":"sed 's/[^^]/[&]/g; s/\\^/\\\\^/g'","input_text":"[a-z]\\+","expected_output":"[[][a][-][z][]][\\][+]","validation_input":"^test$.*","validation_output":"\\^[t][e][s][t][$][.][*]","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed","question_title":"Is it possible to escape regex metacharacters reliably with sed","question_owner":"hek2mgl","answer_owner":"mklement0","answer_id":29613573,"question_score":91,"reviewed":true,"paraphrase_of":"so-29613304","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-30179484","request":"From a list of version strings, print only the last line that matches the pattern of a standard three-part numeric version (e.g., 1.2.3), ignoring any non-matching lines or pre-release tags.","command":"sed -n '/^[[:space:]]*[0-9]\\{1,\\}\\.[0-9]\\{1,\\}\\.[0-9]\\{1,\\}[[:space:]]*$/ h;${g;p;}'","input_text":"2.1.0-dev\n2.1.4\n2.2.0-rc1\n2.2.2\njruby-1.7.19","expected_output":"2.2.2\n","validation_input":"1.0.0-alpha\n1.0.1\n1.1.0-beta\n1.1.2\nmaglev-1.0.0","validation_output":"1.1.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/30179484/install-latest-stable-version-of-ruby-using-rbenv","question_title":"Install Latest Stable Version of Ruby Using rbenv","question_owner":"user636044","answer_owner":"NeronLeVelu","answer_id":30183040,"question_score":53,"reviewed":true} {"id":"so-30179484-p1","request":"From a list of version strings, output only the final line that conforms to the standard three-part numeric version format (e.g., 1.2.3), skipping any lines with pre-release tags or non-matching formats.","command":"sed -n '/^[[:space:]]*[0-9]\\{1,\\}\\.[0-9]\\{1,\\}\\.[0-9]\\{1,\\}[[:space:]]*$/ h;${g;p;}'","input_text":"2.1.0-dev\n2.1.4\n2.2.0-rc1\n2.2.2\njruby-1.7.19","expected_output":"2.2.2\n","validation_input":"1.0.0-alpha\n1.0.1\n1.1.0-beta\n1.1.2\nmaglev-1.0.0","validation_output":"1.1.2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/30179484/install-latest-stable-version-of-ruby-using-rbenv","question_title":"Install Latest Stable Version of Ruby Using rbenv","question_owner":"user636044","answer_owner":"NeronLeVelu","answer_id":30183040,"question_score":53,"reviewed":true,"paraphrase_of":"so-30179484","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-32569032","request":"For lines matching the pattern 'pattern', remove everything up to and including 'text='.","command":"sed '/pattern/s/.*text=//'","input_text":"[01/09/2015] INFO=123 text=hi my number status=new\n[01/09/2015] INFO=456 text=hello world status=old","expected_output":"[01/09/2015] INFO=123 text=hi my number status=new\n[01/09/2015] INFO=456 text=hello world status=old","validation_input":"no match here\nmatch pattern text=extract this status=done","validation_output":"no match here\nextract this status=done","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/32569032/sed-how-to-print-all-lines-after-line-with-a-match","question_title":"sed : how to print all lines after line with a match?","question_owner":"hawarden_","answer_owner":"tripleee","answer_id":32581300,"question_score":43,"reviewed":true} {"id":"so-32569032-p1","request":"For any line matching 'pattern', strip away all content up to and including the substring 'text='.","command":"sed '/pattern/s/.*text=//'","input_text":"[01/09/2015] INFO=123 text=hi my number status=new\n[01/09/2015] INFO=456 text=hello world status=old","expected_output":"[01/09/2015] INFO=123 text=hi my number status=new\n[01/09/2015] INFO=456 text=hello world status=old","validation_input":"no match here\nmatch pattern text=extract this status=done","validation_output":"no match here\nextract this status=done","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/32569032/sed-how-to-print-all-lines-after-line-with-a-match","question_title":"sed : how to print all lines after line with a match?","question_owner":"hawarden_","answer_owner":"tripleee","answer_id":32581300,"question_score":43,"reviewed":true,"paraphrase_of":"so-32569032","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-3350223","request":"Remove all comment lines (lines starting with optional whitespace followed by '#') and all empty lines from the input text using a single sed command.","command":"sed '/^[[:space:]]*#/d;/^$/d'","input_text":"# This is a comment\nLine 1\n\n# Another comment\nLine 2\n # Indented comment\nLine 3","expected_output":"Line 1\nLine 2\nLine 3","validation_input":"Hello World\n# Comment\n\nTest","validation_output":"Hello World\nTest","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3350223/sed-remove-and-empty-lines-with-one-sed-command","question_title":"sed + remove "#" and empty lines with one sed command","question_owner":"lidia","answer_owner":"paxdiablo","answer_id":3350246,"question_score":36,"reviewed":true} {"id":"so-3350223-p1","request":"Use a single sed command to delete both empty lines and comment lines (those beginning with optional whitespace followed by '#') from the input.","command":"sed '/^[[:space:]]*#/d;/^$/d'","input_text":"# This is a comment\nLine 1\n\n# Another comment\nLine 2\n # Indented comment\nLine 3","expected_output":"Line 1\nLine 2\nLine 3","validation_input":"Hello World\n# Comment\n\nTest","validation_output":"Hello World\nTest","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3350223/sed-remove-and-empty-lines-with-one-sed-command","question_title":"sed + remove "#" and empty lines with one sed command","question_owner":"lidia","answer_owner":"paxdiablo","answer_id":3350246,"question_score":36,"reviewed":true,"paraphrase_of":"so-3350223","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-3434462","request":"Print all lines from the first line matching 'match_line' to the end of the input.","command":"sed -n '/match_line/,$p'","input_text":"header\nmatch_line\ncontent\nfooter","expected_output":"match_line\ncontent\nfooter","validation_input":"line1\nline2\nmatch_line found\nend","validation_output":"match_line found\nend","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3434462/print-lines-in-file-from-the-match-line-until-end-of-file","question_title":"Print lines in file from the match line until end of file","question_owner":"lidia","answer_owner":"ghostdog74","answer_id":3434563,"question_score":48,"reviewed":true} {"id":"so-3434462-p1","request":"Output every line starting from the first occurrence of 'match_line' through to the end of the file.","command":"sed -n '/match_line/,$p'","input_text":"header\nmatch_line\ncontent\nfooter","expected_output":"match_line\ncontent\nfooter","validation_input":"line1\nline2\nmatch_line found\nend","validation_output":"match_line found\nend","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3434462/print-lines-in-file-from-the-match-line-until-end-of-file","question_title":"Print lines in file from the match line until end of file","question_owner":"lidia","answer_owner":"ghostdog74","answer_id":3434563,"question_score":48,"reviewed":true,"paraphrase_of":"so-3434462","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-35021524","request":"Add a comma to the end of every line except the last line.","command":"sed '$!s/$/,/'","input_text":"{...}\n{...}\n{...}\n{...}","expected_output":"{...},\n{...},\n{...},\n{...}","validation_input":"line1\nline2\nline3","validation_output":"line1,\nline2,\nline3","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/35021524/how-can-i-add-a-comma-at-the-end-of-every-line-except-the-last-line","question_title":"How can I add a comma at the end of every line except the last line?","question_owner":"Joan Triay","answer_owner":"tripleee","answer_id":35021663,"question_score":60,"reviewed":true} {"id":"so-35021524-p1","request":"Append a comma to the end of each line, excluding the very last line.","command":"sed '$!s/$/,/'","input_text":"{...}\n{...}\n{...}\n{...}","expected_output":"{...},\n{...},\n{...},\n{...}","validation_input":"line1\nline2\nline3","validation_output":"line1,\nline2,\nline3","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/35021524/how-can-i-add-a-comma-at-the-end-of-every-line-except-the-last-line","question_title":"How can I add a comma at the end of every line except the last line?","question_owner":"Joan Triay","answer_owner":"tripleee","answer_id":35021663,"question_score":60,"reviewed":true,"paraphrase_of":"so-35021524","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-3795512","request":"Remove the first five characters from every line that contains at least five characters.","command":"sed 's/^.....//'","input_text":"12345abcdef\n12345ghijk\nshort","expected_output":"abcdef\nghijk\n","validation_input":"Hello World\nABCDE12345\n1234","validation_output":" World\n12345\n1234","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3795512/delete-the-first-five-characters-on-any-line-of-a-text-file-in-linux-with-sed","question_title":"Delete the first five characters on any line of a text file in Linux with sed","question_owner":"JBeg","answer_owner":"PhilR","answer_id":3806107,"question_score":101,"reviewed":true} {"id":"so-3795512-p1","request":"Strip the first five characters from every line that has a length of at least five characters.","command":"sed 's/^.....//'","input_text":"12345abcdef\n12345ghijk\nshort","expected_output":"abcdef\nghijk\n","validation_input":"Hello World\nABCDE12345\n1234","validation_output":" World\n12345\n1234","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3795512/delete-the-first-five-characters-on-any-line-of-a-text-file-in-linux-with-sed","question_title":"Delete the first five characters on any line of a text file in Linux with sed","question_owner":"JBeg","answer_owner":"PhilR","answer_id":3806107,"question_score":101,"reviewed":true,"paraphrase_of":"so-3795512","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-3984824","request":"Replace all occurrences of the percent sign '%' with a dollar sign '$' in the input text.","command":"sed 's/%/$/g'","input_text":"100% complete\n50% done\n0% left","expected_output":"100$ complete\n50$ done\n0$ left","validation_input":"Price is 100%\nDiscount 20%","validation_output":"Price is 100$\nDiscount 20$","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3984824/sed-command-in-bash","question_title":""sed" command in bash","question_owner":"ajsie","answer_owner":"Jack Kelly","answer_id":3984855,"question_score":45,"reviewed":true} {"id":"so-3984824-p1","request":"Substitute every instance of the percent sign '%' with a dollar sign '$' throughout the text.","command":"sed 's/%/$/g'","input_text":"100% complete\n50% done\n0% left","expected_output":"100$ complete\n50$ done\n0$ left","validation_input":"Price is 100%\nDiscount 20%","validation_output":"Price is 100$\nDiscount 20$","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/3984824/sed-command-in-bash","question_title":""sed" command in bash","question_owner":"ajsie","answer_owner":"Jack Kelly","answer_id":3984855,"question_score":45,"reviewed":true,"paraphrase_of":"so-3984824","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-4348166","request":"Extract the numeric part from filenames that may or may not end with '.gz'. For example, extract '1' from 'file_1.gz' and 'file_1'. Use a single sed command that handles both cases.","command":"sed -n 's/.*_\\([0-9][0-9]*\\)\\(\\.gz\\)\\{0,1\\}$/\\1/p'","input_text":"file_1.gz\nfile_2\ndata_99.gz.tar\nimage_5.png","expected_output":"1\n2\n","validation_input":"test_10.gz\nbackup_3","validation_output":"10\n3","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4348166/using-with-sed","question_title":"Using ? with sed","question_owner":"User1","answer_owner":"Laurence Gonsalves","answer_id":4348215,"question_score":36,"reviewed":true} {"id":"so-4348166-p1","request":"Using a single sed command, extract the numeric portion from filenames that may optionally end with '.gz' (e.g., derive '1' from both 'file_1.gz' and 'file_1').","command":"sed -n 's/.*_\\([0-9][0-9]*\\)\\(\\.gz\\)\\{0,1\\}$/\\1/p'","input_text":"file_1.gz\nfile_2\ndata_99.gz.tar\nimage_5.png","expected_output":"1\n2\n","validation_input":"test_10.gz\nbackup_3","validation_output":"10\n3","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4348166/using-with-sed","question_title":"Using ? with sed","question_owner":"User1","answer_owner":"Laurence Gonsalves","answer_id":4348215,"question_score":36,"reviewed":true,"paraphrase_of":"so-4348166","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-4521162","request":"Replace sequences of multiple consecutive empty lines with a single empty line.","command":"sed '/^$/N;/^\\n$/D'","input_text":"Line 1\n\n\n\nLine 2\n\n\nLine 3","expected_output":"Line 1\n\nLine 2\n\nLine 3","validation_input":"Start\n\n\n\n\nEnd","validation_output":"Start\n\nEnd","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4521162/can-i-use-the-sed-command-to-replace-multiple-empty-line-with-one-empty-line","question_title":"Can I use the sed command to replace multiple empty line with one empty line?","question_owner":"Just a learner","answer_owner":"Dennis Williamson","answer_id":4522043,"question_score":43,"reviewed":true} {"id":"so-4521162-p1","request":"Collapse any sequence of multiple consecutive blank lines into a single blank line.","command":"sed '/^$/N;/^\\n$/D'","input_text":"Line 1\n\n\n\nLine 2\n\n\nLine 3","expected_output":"Line 1\n\nLine 2\n\nLine 3","validation_input":"Start\n\n\n\n\nEnd","validation_output":"Start\n\nEnd","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4521162/can-i-use-the-sed-command-to-replace-multiple-empty-line-with-one-empty-line","question_title":"Can I use the sed command to replace multiple empty line with one empty line?","question_owner":"Just a learner","answer_owner":"Dennis Williamson","answer_id":4522043,"question_score":43,"reviewed":true,"paraphrase_of":"so-4521162","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-4953738","request":"Replace all occurrences of 'foo' with 'bar' in lines that do NOT start with '##Input'.","command":"sed '/^##Input/! s/foo/bar/g'","input_text":"##Input foo baz\nfoo is here\nanother foo line","expected_output":"##Input foo baz\nbar is here\nanother bar line","validation_input":"##Input foo\nfoo bar foo\nstart with foo","validation_output":"##Input foo\nbar bar bar\nstart with bar","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4953738/how-to-globally-replace-strings-in-lines-not-starting-with-a-certain-pattern","question_title":"How to globally replace strings in lines NOT starting with a certain pattern","question_owner":"user438602","answer_owner":"Dennis Williamson","answer_id":4953824,"question_score":63,"reviewed":true} {"id":"so-4953738-p1","request":"In lines that do not begin with '##Input', replace every instance of 'foo' with 'bar'.","command":"sed '/^##Input/! s/foo/bar/g'","input_text":"##Input foo baz\nfoo is here\nanother foo line","expected_output":"##Input foo baz\nbar is here\nanother bar line","validation_input":"##Input foo\nfoo bar foo\nstart with foo","validation_output":"##Input foo\nbar bar bar\nstart with bar","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/4953738/how-to-globally-replace-strings-in-lines-not-starting-with-a-certain-pattern","question_title":"How to globally replace strings in lines NOT starting with a certain pattern","question_owner":"user438602","answer_owner":"Dennis Williamson","answer_id":4953824,"question_score":63,"reviewed":true,"paraphrase_of":"so-4953738","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-5047165","request":"Replace the first occurrence of the word 'two' and everything following it on each line with the word 'BLAH'.","command":"sed 's/two.*/BLAH/'","input_text":"one two three five\nfour two five five six\nsix one two seven four","expected_output":"one BLAH\nfour BLAH\nsix one BLAH","validation_input":"start two end\nno match here\ntwo at start","validation_output":"start BLAH\nno match here\nBLAH","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5047165/replacing-from-match-to-end-of-line","question_title":"Replacing from match to end-of-line","question_owner":"GregH","answer_owner":"Andrew Clark","answer_id":5047180,"question_score":51,"reviewed":true} {"id":"so-5047165-p1","request":"On each line, replace the first occurrence of the word 'two' and all subsequent text with 'BLAH'.","command":"sed 's/two.*/BLAH/'","input_text":"one two three five\nfour two five five six\nsix one two seven four","expected_output":"one BLAH\nfour BLAH\nsix one BLAH","validation_input":"start two end\nno match here\ntwo at start","validation_output":"start BLAH\nno match here\nBLAH","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5047165/replacing-from-match-to-end-of-line","question_title":"Replacing from match to end-of-line","question_owner":"GregH","answer_owner":"Andrew Clark","answer_id":5047180,"question_score":51,"reviewed":true,"paraphrase_of":"so-5047165","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-5864146","request":"Replace the string '/foo/bar' with '/baz/qux' in the input text using a sed command that avoids delimiter conflicts with forward slashes.","command":"sed 's,/foo/bar,/baz/qux,g'","input_text":"The path is /foo/bar and it leads to /foo/bar/home.","expected_output":"The path is /baz/qux and it leads to /baz/qux/home.","validation_input":"Go to /foo/bar now.","validation_output":"Go to /baz/qux now.","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5864146/using-different-delimiters-in-sed-commands-and-range-addresses","question_title":"Using different delimiters in sed commands and range addresses","question_owner":"DerZauberer","answer_owner":"geekosaur","answer_id":5864155,"question_score":75,"reviewed":true} {"id":"so-5864146-p1","request":"Replace all instances of '/foo/bar' with '/baz/qux' using a sed command that employs an alternative delimiter to avoid conflicts with forward slashes.","command":"sed 's,/foo/bar,/baz/qux,g'","input_text":"The path is /foo/bar and it leads to /foo/bar/home.","expected_output":"The path is /baz/qux and it leads to /baz/qux/home.","validation_input":"Go to /foo/bar now.","validation_output":"Go to /baz/qux now.","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/5864146/using-different-delimiters-in-sed-commands-and-range-addresses","question_title":"Using different delimiters in sed commands and range addresses","question_owner":"DerZauberer","answer_owner":"geekosaur","answer_id":5864155,"question_score":75,"reviewed":true,"paraphrase_of":"so-5864146","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-6111679","request":"Insert a newline before every occurrence of the string '1234' in the input text.","command":"sed 's/1234/\\n&/g'","input_text":"test1234foo123bar1234","expected_output":"test\n1234foo123bar\n1234","validation_input":"abc1234xyz\n1234start","validation_output":"abc\n1234xyz\n\n1234start","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6111679/insert-linefeed-in-sed-mac-os-x","question_title":"Insert linefeed in sed (Mac OS X)","question_owner":"Tyilo","answer_owner":"przemoc","answer_id":6112270,"question_score":47,"reviewed":true} {"id":"so-6111679-p1","request":"Prepend a newline character to every instance of '1234' found in the text.","command":"sed 's/1234/\\n&/g'","input_text":"test1234foo123bar1234","expected_output":"test\n1234foo123bar\n1234","validation_input":"abc1234xyz\n1234start","validation_output":"abc\n1234xyz\n\n1234start","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6111679/insert-linefeed-in-sed-mac-os-x","question_title":"Insert linefeed in sed (Mac OS X)","question_owner":"Tyilo","answer_owner":"przemoc","answer_id":6112270,"question_score":47,"reviewed":true,"paraphrase_of":"so-6111679","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-6156259","request":"Print lines that contain the substring 'teste', optionally preceded by 'www.'. Use POSIX Basic Regular Expressions only.","command":"sed -n '/\\(www\\.\\)\\{0,1\\}teste/p'","input_text":"http://www.tested.com/\nhttp://tested.com/\nhttp://www.teased.com/","expected_output":"http://www.tested.com/\nhttp://tested.com/\n","validation_input":"www.teste\nno match here\nteste at start","validation_output":"www.teste\nteste at start","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6156259/sed-expression-doesnt-allow-optional-grouped-string","question_title":"Sed expression doesn't allow optional grouped string","question_owner":"Eduardo","answer_owner":"Jonathan Leffler","answer_id":6157705,"question_score":77,"reviewed":true} {"id":"so-6156259-p1","request":"Output lines matching the substring 'teste', which may be optionally prefixed by 'www.', utilizing only POSIX Basic Regular Expressions.","command":"sed -n '/\\(www\\.\\)\\{0,1\\}teste/p'","input_text":"http://www.tested.com/\nhttp://tested.com/\nhttp://www.teased.com/","expected_output":"http://www.tested.com/\nhttp://tested.com/\n","validation_input":"www.teste\nno match here\nteste at start","validation_output":"www.teste\nteste at start","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6156259/sed-expression-doesnt-allow-optional-grouped-string","question_title":"Sed expression doesn't allow optional grouped string","question_owner":"Eduardo","answer_owner":"Jonathan Leffler","answer_id":6157705,"question_score":77,"reviewed":true,"paraphrase_of":"so-6156259","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-6554066","request":"Enclose every line of the input text in double quotes.","command":"sed 's/\\(.*\\)/\"\\1\"/'","input_text":"hello world\nfoo bar\nbaz","expected_output":"\"hello world\"\n\"foo bar\"\n\"baz\"","validation_input":"line one\nline two\n","validation_output":"\"line one\"\n\"line two\"\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6554066/how-to-enclose-every-line-in-a-file-in-double-quotes-with-sed","question_title":"How to enclose every line in a file in double quotes with sed?","question_owner":"nw.","answer_owner":"Karoly Horvath","answer_id":6554082,"question_score":34,"reviewed":true} {"id":"so-6554066-p1","request":"Wrap each line of the input with double quotes.","command":"sed 's/\\(.*\\)/\"\\1\"/'","input_text":"hello world\nfoo bar\nbaz","expected_output":"\"hello world\"\n\"foo bar\"\n\"baz\"","validation_input":"line one\nline two\n","validation_output":"\"line one\"\n\"line two\"\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6554066/how-to-enclose-every-line-in-a-file-in-double-quotes-with-sed","question_title":"How to enclose every line in a file in double quotes with sed?","question_owner":"nw.","answer_owner":"Karoly Horvath","answer_id":6554082,"question_score":34,"reviewed":true,"paraphrase_of":"so-6554066","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-6739258","request":"Insert the line 'nameserver 127.0.0.1' immediately before the first line that starts with 'nameserver'.","command":"sed '1,/^nameserver/ { /^nameserver/i\\\nnameserver 127.0.0.1\n}'","input_text":"# Generated by NetworkManager\ndomain dhcp.example.com\nsearch dhcp.example.com\nnameserver 10.0.0.1\nnameserver 10.0.0.2\nnameserver 10.0.0.3","expected_output":"# Generated by NetworkManager\ndomain dhcp.example.com\nsearch dhcp.example.com\nnameserver 127.0.0.1\nnameserver 10.0.0.1\nnameserver 10.0.0.2\nnameserver 10.0.0.3","validation_input":"domain example.com\nnameserver 8.8.8.8","validation_output":"domain example.com\nnameserver 127.0.0.1\nnameserver 8.8.8.8","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6739258/how-do-i-add-a-line-of-text-to-the-middle-of-a-file-using-bash","question_title":"How do I add a line of text to the middle of a file using bash?","question_owner":"PHLAK","answer_owner":"brandizzi","answer_id":6739322,"question_score":57,"reviewed":true} {"id":"so-6739258-p1","request":"Insert the line 'nameserver 127.0.0.1' directly above the first line beginning with 'nameserver'.","command":"sed '1,/^nameserver/ { /^nameserver/i\\\nnameserver 127.0.0.1\n}'","input_text":"# Generated by NetworkManager\ndomain dhcp.example.com\nsearch dhcp.example.com\nnameserver 10.0.0.1\nnameserver 10.0.0.2\nnameserver 10.0.0.3","expected_output":"# Generated by NetworkManager\ndomain dhcp.example.com\nsearch dhcp.example.com\nnameserver 127.0.0.1\nnameserver 10.0.0.1\nnameserver 10.0.0.2\nnameserver 10.0.0.3","validation_input":"domain example.com\nnameserver 8.8.8.8","validation_output":"domain example.com\nnameserver 127.0.0.1\nnameserver 8.8.8.8","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6739258/how-do-i-add-a-line-of-text-to-the-middle-of-a-file-using-bash","question_title":"How do I add a line of text to the middle of a file using bash?","question_owner":"PHLAK","answer_owner":"brandizzi","answer_id":6739322,"question_score":57,"reviewed":true,"paraphrase_of":"so-6739258","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-6852951","request":"Replace all backslashes with forward slashes in the input text.","command":"sed 's/\\\\/\\//g'","input_text":"C:\\Windows\\Folder\\File.txt","expected_output":"C:/Windows/Folder/File.txt","validation_input":"path\\to\\file\nanother\\path","validation_output":"path/to/file\nanother/path","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6852951/use-sed-to-replace-all-backslashes-with-forward-slashes","question_title":"Use sed to replace all backslashes with forward slashes","question_owner":"Emily","answer_owner":"Emiliano Poggi","answer_id":6853005,"question_score":63,"reviewed":true} {"id":"so-6852951-p1","request":"Substitute every backslash in the text with a forward slash.","command":"sed 's/\\\\/\\//g'","input_text":"C:\\Windows\\Folder\\File.txt","expected_output":"C:/Windows/Folder/File.txt","validation_input":"path\\to\\file\nanother\\path","validation_output":"path/to/file\nanother/path","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6852951/use-sed-to-replace-all-backslashes-with-forward-slashes","question_title":"Use sed to replace all backslashes with forward slashes","question_owner":"Emily","answer_owner":"Emiliano Poggi","answer_id":6853005,"question_score":63,"reviewed":true,"paraphrase_of":"so-6852951","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-6945621","request":"Remove all lines from the start marker '' to the end marker '' inclusive.","command":"sed '//,//d'","input_text":"abc\n\n... a bunch of stuff\n\ndef","expected_output":"abc\ndef","validation_input":"keep this\n\ndelete this\n\nkeep this too","validation_output":"keep this\nkeep this too","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6945621/using-sed-to-remove-a-block-of-text","question_title":"Using sed to remove a block of text","question_owner":"Scott C Wilson","answer_owner":"Maxim Egorushkin","answer_id":6945788,"question_score":41,"reviewed":true} {"id":"so-6945621-p1","request":"Delete all lines ranging from the start marker '' to the end marker '', including the markers themselves.","command":"sed '//,//d'","input_text":"abc\n\n... a bunch of stuff\n\ndef","expected_output":"abc\ndef","validation_input":"keep this\n\ndelete this\n\nkeep this too","validation_output":"keep this\nkeep this too","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/6945621/using-sed-to-remove-a-block-of-text","question_title":"Using sed to remove a block of text","question_owner":"Scott C Wilson","answer_owner":"Maxim Egorushkin","answer_id":6945788,"question_score":41,"reviewed":true,"paraphrase_of":"so-6945621","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-7103863","request":"Print only the second line of the input text.","command":"sed -n '2p'","input_text":"@SRR005108.1 :3:1:643:216\nGATTTCTGGCCCGCCGCTCGATAATACAGTAATTCC\n+\nIIIIII/III*IIIIIIIIII+IIIII;IIAIII%>","expected_output":"GATTTCTGGCCCGCCGCTCGATAATACAGTAATTCC\n","validation_input":"line1\nline2\nline3","validation_output":"line2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7103863/how-to-get-only-second-line-with-sed","question_title":"How to get ONLY Second line with SED","question_owner":"neversaint","answer_owner":"Jonathan","answer_id":7103911,"question_score":41,"reviewed":true} {"id":"so-7103863-p1","request":"Display exclusively the second line from the input.","command":"sed -n '2p'","input_text":"@SRR005108.1 :3:1:643:216\nGATTTCTGGCCCGCCGCTCGATAATACAGTAATTCC\n+\nIIIIII/III*IIIIIIIIII+IIIII;IIAIII%>","expected_output":"GATTTCTGGCCCGCCGCTCGATAATACAGTAATTCC\n","validation_input":"line1\nline2\nline3","validation_output":"line2\n","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7103863/how-to-get-only-second-line-with-sed","question_title":"How to get ONLY Second line with SED","question_owner":"neversaint","answer_owner":"Jonathan","answer_id":7103911,"question_score":41,"reviewed":true,"paraphrase_of":"so-7103863","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-7359527","request":"Remove all leading empty lines from the input stream.","command":"sed '/./,$!d'","input_text":"\n\nfirst line\nsecond line","expected_output":"first line\nsecond line","validation_input":"\nstart here\n\nmiddle blank","validation_output":"start here\n\nmiddle blank","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,"reviewed":true} {"id":"so-7359527-p1","request":"Strip all initial blank lines from the input stream.","command":"sed '/./,$!d'","input_text":"\n\nfirst line\nsecond line","expected_output":"first line\nsecond line","validation_input":"\nstart here\n\nmiddle blank","validation_output":"start here\n\nmiddle blank","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,"reviewed":true,"paraphrase_of":"so-7359527","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-7635807","request":"Remove all double quote characters from the input text.","command":"sed 's/\"//g'","input_text":"He said \"hello\" to her.\nShe replied \"hi\" back.","expected_output":"He said hello to her.\nShe replied hi back.","validation_input":"No \"quotes\" here.\nJust text.","validation_output":"No quotes here.\nJust text.","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7635807/how-to-use-sed-to-remove-all-double-quotes-within-a-file","question_title":"How to use sed to remove all double quotes within a file","question_owner":"MRTim2day","answer_owner":"user104863","answer_id":7635852,"question_score":63,"reviewed":true} {"id":"so-7635807-p1","request":"Delete every double quote character from the text.","command":"sed 's/\"//g'","input_text":"He said \"hello\" to her.\nShe replied \"hi\" back.","expected_output":"He said hello to her.\nShe replied hi back.","validation_input":"No \"quotes\" here.\nJust text.","validation_output":"No quotes here.\nJust text.","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7635807/how-to-use-sed-to-remove-all-double-quotes-within-a-file","question_title":"How to use sed to remove all double quotes within a file","question_owner":"MRTim2day","answer_owner":"user104863","answer_id":7635852,"question_score":63,"reviewed":true,"paraphrase_of":"so-7635807","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-7657647","request":"Remove all occurrences of the strings 'File' and 'MINvac.pdb' from each line of the input text.","command":"sed 's/File//g;s/MINvac\\.pdb//g'","input_text":"-6174.27 File10MINvac.pdb\n-514.451 File11MINvac.pdb","expected_output":"-6174.27 10\n-514.451 11","validation_input":"4065.68 File12MINvac.pdb\n-4708.64 File13MINvac.pdb","validation_output":"4065.68 12\n-4708.64 13","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7657647/combining-two-sed-commands","question_title":"Combining two sed commands","question_owner":"kanika","answer_owner":"tripleee","answer_id":7657662,"question_score":81,"reviewed":true} {"id":"so-7657647-p1","request":"Strip the strings 'File' and 'MINvac.pdb' from every line in the input.","command":"sed 's/File//g;s/MINvac\\.pdb//g'","input_text":"-6174.27 File10MINvac.pdb\n-514.451 File11MINvac.pdb","expected_output":"-6174.27 10\n-514.451 11","validation_input":"4065.68 File12MINvac.pdb\n-4708.64 File13MINvac.pdb","validation_output":"4065.68 12\n-4708.64 13","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7657647/combining-two-sed-commands","question_title":"Combining two sed commands","question_owner":"kanika","answer_owner":"tripleee","answer_id":7657662,"question_score":81,"reviewed":true,"paraphrase_of":"so-7657647","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-7680504","request":"Replace all occurrences of the literal text 'draw(1;n_)' with 'draw(2;n_)' in the input stream.","command":"sed 's/draw(1;n_)/draw(2;n_)/g'","input_text":"call draw(1;n_) here\nand draw(1;n_) there","expected_output":"call draw(2;n_) here\nand draw(2;n_) there","validation_input":"draw(1;n_) only","validation_output":"draw(2;n_) only","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7680504/sed-substitution-with-bash-variables","question_title":"sed substitution with Bash variables","question_owner":"csta","answer_owner":"k.parnell","answer_id":7680548,"question_score":90,"reviewed":true} {"id":"so-7680504-p1","request":"Substitute every instance of the literal string 'draw(1;n_)' with 'draw(2;n_)' throughout the input.","command":"sed 's/draw(1;n_)/draw(2;n_)/g'","input_text":"call draw(1;n_) here\nand draw(1;n_) there","expected_output":"call draw(2;n_) here\nand draw(2;n_) there","validation_input":"draw(1;n_) only","validation_output":"draw(2;n_) only","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7680504/sed-substitution-with-bash-variables","question_title":"sed substitution with Bash variables","question_owner":"csta","answer_owner":"k.parnell","answer_id":7680548,"question_score":90,"reviewed":true,"paraphrase_of":"so-7680504","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-7814205","request":"Remove the first word from each line of the input text.","command":"sed 's/^[^ ]* //'","input_text":"some text 1\nsome text 2\nsome text 3","expected_output":"text 1\ntext 2\ntext 3","validation_input":"hello world\nfoo bar baz","validation_output":"world\nbar baz","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7814205/remove-the-first-word-in-a-text-stream","question_title":"Remove the first word in a text stream","question_owner":"Trcx","answer_owner":"Kent","answer_id":7814456,"question_score":44,"reviewed":true} {"id":"so-7814205-p1","request":"Delete the first word from every line of the input.","command":"sed 's/^[^ ]* //'","input_text":"some text 1\nsome text 2\nsome text 3","expected_output":"text 1\ntext 2\ntext 3","validation_input":"hello world\nfoo bar baz","validation_output":"world\nbar baz","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7814205/remove-the-first-word-in-a-text-stream","question_title":"Remove the first word in a text stream","question_owner":"Trcx","answer_owner":"Kent","answer_id":7814456,"question_score":44,"reviewed":true,"paraphrase_of":"so-7814205","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-7852132","request":"Join consecutive lines into a single line if the current line ends with the character '0', appending the next line to it and removing the newline between them. Repeat until a line not ending in '0' is found or end of file.","command":"sed ':a;/0$/{N;s/\\n//;ba}'","input_text":"412|n|Leader Building Material||||||||||d|d|20||0\n107|n|Knot Tying Tools|||||Knot Tying Tools\n|||||d|d|0||0\nAnother line\nEnds with 0\nNext part","expected_output":"412|n|Leader Building Material||||||||||d|d|20||0107|n|Knot Tying Tools|||||Knot Tying Tools\n|||||d|d|0||0Another line\nEnds with 0Next part","validation_input":"Line ending in 0\ncontinuation\nNormal line\nZero at end0\nmore data","validation_output":"Line ending in 0continuation\nNormal line\nZero at end0more data","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7852132/sed-join-lines-together","question_title":"sed join lines together","question_owner":"veilig","answer_owner":"ninjalj","answer_id":7853846,"question_score":37,"reviewed":true} {"id":"so-7852132-p1","request":"Merge consecutive lines into one if the current line ends with '0' by appending the next line and stripping the intervening newline; continue this process until a line not ending in '0' is encountered or the file ends.","command":"sed ':a;/0$/{N;s/\\n//;ba}'","input_text":"412|n|Leader Building Material||||||||||d|d|20||0\n107|n|Knot Tying Tools|||||Knot Tying Tools\n|||||d|d|0||0\nAnother line\nEnds with 0\nNext part","expected_output":"412|n|Leader Building Material||||||||||d|d|20||0107|n|Knot Tying Tools|||||Knot Tying Tools\n|||||d|d|0||0Another line\nEnds with 0Next part","validation_input":"Line ending in 0\ncontinuation\nNormal line\nZero at end0\nmore data","validation_output":"Line ending in 0continuation\nNormal line\nZero at end0more data","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/7852132/sed-join-lines-together","question_title":"sed join lines together","question_owner":"veilig","answer_owner":"ninjalj","answer_id":7853846,"question_score":37,"reviewed":true,"paraphrase_of":"so-7852132","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-8008546","request":"Remove all double quote characters from the input text.","command":"sed 's/\"//g'","input_text":"EngineVersion=\"5.2.5.624\"\nName=\"Test\"","expected_output":"EngineVersion=5.2.5.624\nName=Test","validation_input":"\"hello\" world\nno quotes here","validation_output":"hello world\nno quotes here","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8008546/remove-a-specific-character-using-awk-or-sed","question_title":"Remove a specific character using awk or sed","question_owner":"AabinGunz","answer_owner":"Piotr Praszmo","answer_id":8008729,"question_score":50,"reviewed":true} {"id":"so-8008546-p1","request":"Strip all double quote characters from the provided text.","command":"sed 's/\"//g'","input_text":"EngineVersion=\"5.2.5.624\"\nName=\"Test\"","expected_output":"EngineVersion=5.2.5.624\nName=Test","validation_input":"\"hello\" world\nno quotes here","validation_output":"hello world\nno quotes here","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8008546/remove-a-specific-character-using-awk-or-sed","question_title":"Remove a specific character using awk or sed","question_owner":"AabinGunz","answer_owner":"Piotr Praszmo","answer_id":8008729,"question_score":50,"reviewed":true,"paraphrase_of":"so-8008546","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-8857705","request":"Delete the first two lines of the input text.","command":"sed '1,2d'","input_text":"blah\nblahsdfsj\n1\n2\n3\n4","expected_output":"1\n2\n3\n4","validation_input":"header1\nheader2\ndata1\ndata2","validation_output":"data1\ndata2","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8857705/deleting-the-first-two-lines-of-a-file-using-bash-or-awk-or-sed-or-whatever","question_title":"Deleting the first two lines of a file using BASH or awk or sed or whatever","question_owner":"Amit","answer_owner":"RobS","answer_id":8857734,"question_score":41,"reviewed":true} {"id":"so-8857705-p1","request":"Discard the first two lines of the input.","command":"sed '1,2d'","input_text":"blah\nblahsdfsj\n1\n2\n3\n4","expected_output":"1\n2\n3\n4","validation_input":"header1\nheader2\ndata1\ndata2","validation_output":"data1\ndata2","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/8857705/deleting-the-first-two-lines-of-a-file-using-bash-or-awk-or-sed-or-whatever","question_title":"Deleting the first two lines of a file using BASH or awk or sed or whatever","question_owner":"Amit","answer_owner":"RobS","answer_id":8857734,"question_score":41,"reviewed":true,"paraphrase_of":"so-8857705","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-9053100","request":"Replace substrings that start with BEGIN_, end with _END, and have content other than FOO in between, with the inner content wrapped in parentheses. Leave BEGIN_FOO_END unchanged.","command":"sed '/BEGIN_FOO_END/b; s/BEGIN_\\(.*\\)_END/(\\1)/g'","input_text":"BEGIN_bar_END\nBEGIN_buz_END\nBEGIN_FOO_END\nBEGIN_ihfd8f398IHFf9f39_END","expected_output":"(bar)\n(buz)\nBEGIN_FOO_END\n(ihfd8f398IHFf9f39)","validation_input":"test_BEGIN_x_END\nBEGIN_FOO_END\nBEGIN_y_END","validation_output":"test_(x)\nBEGIN_FOO_END\n(y)","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9053100/sed-regex-and-substring-negation","question_title":"Sed regex and substring negation","question_owner":"Anthony","answer_owner":"Fred Foo","answer_id":9053163,"question_score":52,"reviewed":true} {"id":"so-9053100-p1","request":"For substrings beginning with BEGIN_ and ending with _END, replace them with their inner content enclosed in parentheses, unless the inner content is exactly FOO, in which case leave BEGIN_FOO_END unchanged.","command":"sed '/BEGIN_FOO_END/b; s/BEGIN_\\(.*\\)_END/(\\1)/g'","input_text":"BEGIN_bar_END\nBEGIN_buz_END\nBEGIN_FOO_END\nBEGIN_ihfd8f398IHFf9f39_END","expected_output":"(bar)\n(buz)\nBEGIN_FOO_END\n(ihfd8f398IHFf9f39)","validation_input":"test_BEGIN_x_END\nBEGIN_FOO_END\nBEGIN_y_END","validation_output":"test_(x)\nBEGIN_FOO_END\n(y)","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9053100/sed-regex-and-substring-negation","question_title":"Sed regex and substring negation","question_owner":"Anthony","answer_owner":"Fred Foo","answer_id":9053163,"question_score":52,"reviewed":true,"paraphrase_of":"so-9053100","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-9189120","request":"Replace the substring 'string-' followed by any single character with 'string-0' in each line.","command":"sed 's/string-./string-0/g'","input_text":"some-string-8\nother-string-X\nno-match-here","expected_output":"some-string-0\nother-string-0\nno-match-here","validation_input":"test-string-5\nstring-a-end","validation_output":"test-string-0\nstring-0-end","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9189120/using-sed-with-wildcard","question_title":"Using SED with wildcard","question_owner":"mahmood","answer_owner":"tom","answer_id":9189153,"question_score":57,"reviewed":true} {"id":"so-9189120-p1","request":"In every line, substitute any instance of 'string-' followed by a single character with 'string-0'.","command":"sed 's/string-./string-0/g'","input_text":"some-string-8\nother-string-X\nno-match-here","expected_output":"some-string-0\nother-string-0\nno-match-here","validation_input":"test-string-5\nstring-a-end","validation_output":"test-string-0\nstring-0-end","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9189120/using-sed-with-wildcard","question_title":"Using SED with wildcard","question_owner":"mahmood","answer_owner":"tom","answer_id":9189153,"question_score":57,"reviewed":true,"paraphrase_of":"so-9189120","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-9205669","request":"Replace all occurrences of the literal string {test1} with test2 in the input text.","command":"sed 's/{test1}/test2/g'","input_text":"This is a test {test1} line.\nAnother {test1} occurrence here.\nNo match here.\nEnd of {test1} file.","expected_output":"This is a test test2 line.\nAnother test2 occurrence here.\nNo match here.\nEnd of test2 file.","validation_input":"Start {test1} middle {test1} end.\nSingle {test1} line.","validation_output":"Start test2 middle test2 end.\nSingle test2 line.","family":"real-stackoverflow","difficulty":3,"split":"train","source":"stackoverflow-accepted-answer","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9205669/sed-find-and-replace-with-curly-braces","question_title":"sed find and replace with curly braces","question_owner":"atdev","answer_owner":"kev","answer_id":9205806,"question_score":39,"reviewed":true} {"id":"so-9205669-p1","request":"Replace every occurrence of the literal string {test1} with test2 throughout the input.","command":"sed 's/{test1}/test2/g'","input_text":"This is a test {test1} line.\nAnother {test1} occurrence here.\nNo match here.\nEnd of {test1} file.","expected_output":"This is a test test2 line.\nAnother test2 occurrence here.\nNo match here.\nEnd of test2 file.","validation_input":"Start {test1} middle {test1} end.\nSingle {test1} line.","validation_output":"Start test2 middle test2 end.\nSingle test2 line.","family":"real-stackoverflow","difficulty":3,"split":"train","source":"openrouter-paraphrase","license":"CC-BY-SA-4.0","question_url":"https://stackoverflow.com/questions/9205669/sed-find-and-replace-with-curly-braces","question_title":"sed find and replace with curly braces","question_owner":"atdev","answer_owner":"kev","answer_id":9205806,"question_score":39,"reviewed":true,"paraphrase_of":"so-9205669","paraphrase_model":"qwen/qwen3.7-plus"} {"id":"so-9591744","request":"Append ' anotherthing' to the end of any line that starts with 'all:'.","command":"sed '/^all:/ s/$/ anotherthing/'","input_text":"somestuff...\nall: thing otherthing\nsome other stuff","expected_output":"somestuff...\nall: thing otherthing anotherthing\nsome other stuff","validation_input":"all: foo\nbar: baz","validation_output":"all: foo anotherthing\nbar: baz","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,"reviewed":true} {"id":"so-9591744-p1","request":"Add ' anotherthing' to the end of any line that begins with 'all:'.","command":"sed '/^all:/ s/$/ anotherthing/'","input_text":"somestuff...\nall: thing otherthing\nsome other stuff","expected_output":"somestuff...\nall: thing otherthing anotherthing\nsome other stuff","validation_input":"all: foo\nbar: baz","validation_output":"all: foo anotherthing\nbar: baz","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,"reviewed":true,"paraphrase_of":"so-9591744","paraphrase_model":"qwen/qwen3.7-plus"}