Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
10
17
request
stringlengths
41
222
command
stringlengths
10
84
input_text
stringlengths
7
167
expected_output
stringlengths
4
158
validation_input
stringlengths
8
92
validation_output
stringlengths
2
96
family
stringclasses
1 value
difficulty
int64
3
3
split
stringclasses
1 value
source
stringclasses
3 values
license
stringclasses
1 value
question_url
stringlengths
58
123
question_title
stringlengths
16
88
question_owner
stringlengths
3
23
answer_owner
stringlengths
3
18
answer_id
int64
1.07M
35M
question_score
int64
34
102
reviewed
bool
1 class
paraphrase_of
stringlengths
10
14
⌀
paraphrase_model
stringclasses
1 value
variation_of
stringclasses
4 values
variation_model
stringclasses
1 value
so-10613643
Replace the content between 'WORD1' and 'WORD3' on the same line with 'foo', preserving 'WORD1' and 'WORD3'.
sed -e 's/WORD1.*WORD3/WORD1 foo WORD3/g'
WORD1 WORD2 WORD3 WORD1 abcdef WORD3 No match here
WORD1 foo WORD3 WORD1 foo WORD3 No match here
WORD1 xyz WORD3 WORD1 123 WORD3 extra WORD1 WORD3
WORD1 foo WORD3 WORD1 foo WORD3 extra WORD1 foo WORD3
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/10613643/replace-a-unknown-string-between-two-known-strings-with-sed
replace a unknown string between two known strings with sed
Camden S.
vyegorov
10,613,688
40
true
null
null
null
null
so-10613643-p1
On each line, substitute the text situated between 'WORD1' and 'WORD3' with 'foo', while keeping 'WORD1' and 'WORD3' intact.
sed -e 's/WORD1.*WORD3/WORD1 foo WORD3/g'
WORD1 WORD2 WORD3 WORD1 abcdef WORD3 No match here
WORD1 foo WORD3 WORD1 foo WORD3 No match here
WORD1 xyz WORD3 WORD1 123 WORD3 extra WORD1 WORD3
WORD1 foo WORD3 WORD1 foo WORD3 extra WORD1 foo WORD3
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/10613643/replace-a-unknown-string-between-two-known-strings-with-sed
replace a unknown string between two known strings with sed
Camden S.
vyegorov
10,613,688
40
true
so-10613643
qwen/qwen3.7-plus
null
null
so-1074450
Replace the value following 'DBSERVERNAME' (separated by whitespace) with 'yyy', preserving the key name and case-insensitivity.
sed -e 's/\(DBSERVERNAME\)[[:space:]]\+[[:alnum:]_]\+/\1 yyy/I'
DBSERVERNAME xxx OTHERKEY value
DBSERVERNAME yyy OTHERKEY value
dbservername old_value DBSERVERNAME new_val
dbservername yyy DBSERVERNAME yyy
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/1074450/sed-replace-part-of-a-line
sed: Replace part of a line
calvinkrishy
Jeremy Stein
1,074,533
49
true
null
null
null
null
so-1074450-p1
Update the value associated with 'DBSERVERNAME' (delimited by whitespace) to 'yyy', maintaining the key name and ensuring case-insensitive matching.
sed -e 's/\(DBSERVERNAME\)[[:space:]]\+[[:alnum:]_]\+/\1 yyy/I'
DBSERVERNAME xxx OTHERKEY value
DBSERVERNAME yyy OTHERKEY value
dbservername old_value DBSERVERNAME new_val
dbservername yyy DBSERVERNAME yyy
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/1074450/sed-replace-part-of-a-line
sed: Replace part of a line
calvinkrishy
Jeremy Stein
1,074,533
49
true
so-1074450
qwen/qwen3.7-plus
null
null
so-1187078
Insert a newline character after every 20 characters in the input text.
sed -e 's/.\{20\}/&\n/g'
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRST UVWXYZ0123456789abcd efghijklmnopqrstuvwx yz
123456789012345678901234567890
12345678901234567890 1234567890
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/1187078/how-to-insert-a-new-line-character-after-a-fixed-number-of-characters-in-a-file
How to insert a new line character after a fixed number of characters in a file
rangalo
Kristian
1,187,225
48
true
null
null
null
null
so-1187078-p1
Break the input text by inserting a newline character after every 20 characters.
sed -e 's/.\{20\}/&\n/g'
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRST UVWXYZ0123456789abcd efghijklmnopqrstuvwx yz
123456789012345678901234567890
12345678901234567890 1234567890
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/1187078/how-to-insert-a-new-line-character-after-a-fixed-number-of-characters-in-a-file
How to insert a new line character after a fixed number of characters in a file
rangalo
Kristian
1,187,225
48
true
so-1187078
qwen/qwen3.7-plus
null
null
so-1187354
Comment out all lines between the start marker '=sec1=' and the end marker '=sec2=', excluding the marker lines themselves.
sed -e '/=sec1=/,/=sec2=/ { /=sec1=/b; /=sec2=/b; s/^/#/ }'
=sec1= some-line some-other-line foo bar=baz =sec2= c=baz
=sec1= #some-line #some-other-line #foo #bar=baz =sec2= c=baz
=sec1= keep this and this =sec2= outside
=sec1= #keep this #and this =sec2= outside
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/1187354/excluding-first-and-last-lines-from-sed-start-end
excluding first and last lines from sed /START/,/END/
Chen Levy
Ville Laurikari
1,187,517
53
true
null
null
null
null
so-1187354-p1
Add comment markers to all lines located between '=sec1=' and '=sec2=', but do not modify the marker lines themselves.
sed -e '/=sec1=/,/=sec2=/ { /=sec1=/b; /=sec2=/b; s/^/#/ }'
=sec1= some-line some-other-line foo bar=baz =sec2= c=baz
=sec1= #some-line #some-other-line #foo #bar=baz =sec2= c=baz
=sec1= keep this and this =sec2= outside
=sec1= #keep this #and this =sec2= outside
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/1187354/excluding-first-and-last-lines-from-sed-start-end
excluding first and last lines from sed /START/,/END/
Chen Levy
Ville Laurikari
1,187,517
53
true
so-1187354
qwen/qwen3.7-plus
null
null
so-11958369
Replace 'mystring' with '1' if the line contains 'searchstring', otherwise replace 'mystring' with '0'.
sed -e '/searchstring/ s/mystring/1/ ; s/mystring/0/'
some text mystring some other text some text mystring a searchstring just some more text
some text 0 some other text some text 1 a searchstring just some more text
mystring here no match mystring searchstring and mystring
0 here no match 0 searchstring and 1
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/11958369/replace-only-if-string-exists-in-current-line
Replace only if string exists in current line
Anders Lind
Ihor Kaharlichenko
11,958,566
41
true
null
null
null
null
so-11958369-p1
If a line includes 'searchstring', change 'mystring' to '1'; otherwise, change 'mystring' to '0'.
sed -e '/searchstring/ s/mystring/1/ ; s/mystring/0/'
some text mystring some other text some text mystring a searchstring just some more text
some text 0 some other text some text 1 a searchstring just some more text
mystring here no match mystring searchstring and mystring
0 here no match 0 searchstring and 1
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/11958369/replace-only-if-string-exists-in-current-line
Replace only if string exists in current line
Anders Lind
Ihor Kaharlichenko
11,958,566
41
true
so-11958369
qwen/qwen3.7-plus
null
null
so-12061410
Replace the string 'AAA' with 'BBB' in the input text, using '+' as the delimiter to avoid conflicts with forward slashes in paths.
sed 's+AAA+BBB+'
path is AAA/subdir
path is BBB/subdir
AAA/BBB/CCC
BBB/BBB/CCC
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/12061410/how-to-replace-a-path-with-another-path-in-sed
How to replace a path with another path in sed?
Brian Postow
Lev Levitsky
12,061,491
100
true
null
null
null
null
so-12061410-p1
Substitute 'AAA' with 'BBB' throughout the text, employing '+' as the delimiter to prevent issues with forward slashes in file paths.
sed 's+AAA+BBB+'
path is AAA/subdir
path is BBB/subdir
AAA/BBB/CCC
BBB/BBB/CCC
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/12061410/how-to-replace-a-path-with-another-path-in-sed
How to replace a path with another path in sed?
Brian Postow
Lev Levitsky
12,061,491
100
true
so-12061410
qwen/qwen3.7-plus
null
null
so-12297859
Remove all characters from the beginning of each line up to and including the first colon character.
sed 's/^[^:]*://'
TF_list_to_test10004/Nus_k0.345_t0.1_e0.1.adj:PKMYT1 GeneID:BRCA2
PKMYT1 BRCA2
prefix:value no_colon_here key:data_point
value no_colon_here data_point
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/12297859/remove-all-text-before-colon
Remove all text before colon
NewUsr_stat
Sacha Epskamp
12,297,934
77
true
null
null
null
null
so-12297859-p1
Strip all characters from the start of each line up to and including the first colon.
sed 's/^[^:]*://'
TF_list_to_test10004/Nus_k0.345_t0.1_e0.1.adj:PKMYT1 GeneID:BRCA2
PKMYT1 BRCA2
prefix:value no_colon_here key:data_point
value no_colon_here data_point
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/12297859/remove-all-text-before-colon
Remove all text before colon
NewUsr_stat
Sacha Epskamp
12,297,934
77
true
so-12297859
qwen/qwen3.7-plus
null
null
so-12974162
Extract the sequence of digits that appears immediately before the file extension in a pathname string.
sed -n 's/.*_\([0-9]*\)\..*/\1/p'
./pentaray_run2/Trace_220560.dat
220560
/path/to/file_log_987.csv
987
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/12974162/extract-numbers-from-a-string-using-sed-and-regular-expressions
Extract numbers from a string using sed and regular expressions
Steven
Kent
12,974,208
34
true
null
null
null
null
so-12974162-p1
Retrieve the digit sequence found directly before the file extension in a given path string.
sed -n 's/.*_\([0-9]*\)\..*/\1/p'
./pentaray_run2/Trace_220560.dat
220560
/path/to/file_log_987.csv
987
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/12974162/extract-numbers-from-a-string-using-sed-and-regular-expressions
Extract numbers from a string using sed and regular expressions
Steven
Kent
12,974,208
34
true
so-12974162
qwen/qwen3.7-plus
null
null
so-13316437
Insert the line 'New Inserted Line' immediately after every occurrence of the line containing exactly 'fields'.
sed '/^fields$/a\New Inserted Line'
line 1 line 2 fields line 3 another line fields dkhs
line 1 line 2 fields New Inserted Line line 3 another line fields New Inserted Line dkhs
start fields end
start fields New Inserted Line end
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/13316437/insert-lines-in-a-file-starting-from-a-specific-line
Insert lines in a file starting from a specific line
Sadiel
Chris Seymour
13,316,554
66
true
null
null
null
null
so-13316437-p1
Add the line 'New Inserted Line' right after any line that consists exactly of 'fields'.
sed '/^fields$/a\New Inserted Line'
line 1 line 2 fields line 3 another line fields dkhs
line 1 line 2 fields New Inserted Line line 3 another line fields New Inserted Line dkhs
start fields end
start fields New Inserted Line end
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/13316437/insert-lines-in-a-file-starting-from-a-specific-line
Insert lines in a file starting from a specific line
Sadiel
Chris Seymour
13,316,554
66
true
so-13316437
qwen/qwen3.7-plus
null
null
so-13538772
Replace every space character with a comma in the input text.
sed 's/ /,/g'
53 51097 310780 1 56 260 1925 1 68 51282 278770 1
53,51097,310780,1 56,260,1925,1 68,51282,278770,1
a b c d e f g h
a,b,c,d e,f,g,h
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/13538772/how-to-replace-space-with-comma-using-sed
How to replace space with comma using sed?
Teja
mvp
13,538,795
36
true
null
null
null
null
so-13538772-p1
Convert all space characters in the input text to commas.
sed 's/ /,/g'
53 51097 310780 1 56 260 1925 1 68 51282 278770 1
53,51097,310780,1 56,260,1925,1 68,51282,278770,1
a b c d e f g h
a,b,c,d e,f,g,h
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/13538772/how-to-replace-space-with-comma-using-sed
How to replace space with comma using sed?
Teja
mvp
13,538,795
36
true
so-13538772
qwen/qwen3.7-plus
null
null
so-13586349
Prepend the string 'prefix' to the beginning of each line in the input.
sed 's/^/prefix/'
line1 line2
prefixline1 prefixline2
hello world
prefixhello prefixworld
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/13586349/how-can-i-prepend-a-string-to-the-beginning-of-each-line-in-a-file
How can I prepend a string to the beginning of each line in a file?
bobbyrne01
nullrevolution
13,587,466
55
true
null
null
null
null
so-13586349-p1
Add the string 'prefix' to the start of every line in the input.
sed 's/^/prefix/'
line1 line2
prefixline1 prefixline2
hello world
prefixhello prefixworld
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/13586349/how-can-i-prepend-a-string-to-the-beginning-of-each-line-in-a-file
How can I prepend a string to the beginning of each line in a file?
bobbyrne01
nullrevolution
13,587,466
55
true
so-13586349
qwen/qwen3.7-plus
null
null
so-14135027
Replace Danish characters 'æ', 'ø', and 'å' with 'ae', 'oe', and 'aa' respectively, and their uppercase counterparts 'Æ', 'Ø', 'Å' with 'Ae', 'Oe', and 'Aa' respectively.
sed 's/æ/ae/g;s/ø/oe/g;s/å/aa/g;s/Æ/Ae/g;s/Ø/Oe/g;s/Å/Aa/g'
Rødgrød med flæsk Århus Øl
Roedgroed med flaesk Aarhus Oel
Jeg spiser grød Æblet er sødt
Jeg spiser groed Aeblet er soedt
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/14135027/regular-expression-in-sed-for-multiple-replacements-in-one-statement
Regular Expression in sed for multiple replacements in one statement
Jan
Anders Johansson
14,135,068
45
true
null
null
null
null
so-14135027-p1
Translate Danish letters 'æ', 'ø', 'å' to 'ae', 'oe', 'aa' and their uppercase forms 'Æ', 'Ø', 'Å' to 'Ae', 'Oe', 'Aa' respectively.
sed 's/æ/ae/g;s/ø/oe/g;s/å/aa/g;s/Æ/Ae/g;s/Ø/Oe/g;s/Å/Aa/g'
Rødgrød med flæsk Århus Øl
Roedgroed med flaesk Aarhus Oel
Jeg spiser grød Æblet er sødt
Jeg spiser groed Aeblet er soedt
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/14135027/regular-expression-in-sed-for-multiple-replacements-in-one-statement
Regular Expression in sed for multiple replacements in one statement
Jan
Anders Johansson
14,135,068
45
true
so-14135027
qwen/qwen3.7-plus
null
null
so-14137353
Comment out any line containing the string 'myvar' by prepending '//' to the beginning of that line.
sed 's/\(^.*myvar.*$\)/\/\/\1/'
class hw { public static void main(String[] args) { System.out.println("Hello World!"); myvar=1 } }
class hw { public static void main(String[] args) { System.out.println("Hello World!"); //myvar=1 } }
int x = 0; myvar++; // myvar is here int y = myvar + 1;
int x = 0; //myvar++; //// myvar is here //int y = myvar + 1;
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/14137353/using-sed-to-replace-beginning-of-line-when-match-found
Using sed to replace beginning of line when match found
dublintech
Chris Seymour
14,137,448
37
true
null
null
null
null
so-14137353-p1
Prepend '//' to the start of any line that includes the string 'myvar' to comment it out.
sed 's/\(^.*myvar.*$\)/\/\/\1/'
class hw { public static void main(String[] args) { System.out.println("Hello World!"); myvar=1 } }
class hw { public static void main(String[] args) { System.out.println("Hello World!"); //myvar=1 } }
int x = 0; myvar++; // myvar is here int y = myvar + 1;
int x = 0; //myvar++; //// myvar is here //int y = myvar + 1;
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/14137353/using-sed-to-replace-beginning-of-line-when-match-found
Using sed to replace beginning of line when match found
dublintech
Chris Seymour
14,137,448
37
true
so-14137353
qwen/qwen3.7-plus
null
null
so-14840953
Remove the trailing comma from the end of each line in the input text.
sed 's/,$//'
SUPPLIER_PROC_ID BIGINT NOT NULL, BTCH_NBR INTEGER NOT NULL, RX_BTCH_SUPPLIER_SEQ_NBR INTEGER NOT NULL,
SUPPLIER_PROC_ID BIGINT NOT NULL BTCH_NBR INTEGER NOT NULL RX_BTCH_SUPPLIER_SEQ_NBR INTEGER NOT NULL
DATA_TYP_CD BYTEINT NOT NULL, DATA_PD_CD BYTEINT NOT NULL,
DATA_TYP_CD BYTEINT NOT NULL DATA_PD_CD BYTEINT NOT NULL
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/14840953/how-to-remove-a-character-at-the-end-of-each-line-in-unix
How to remove a character at the end of each line in UNIX
Teja
jlliagre
14,840,982
67
true
null
null
null
null
so-14840953-p1
Strip the trailing comma from the end of every line in the provided text.
sed 's/,$//'
SUPPLIER_PROC_ID BIGINT NOT NULL, BTCH_NBR INTEGER NOT NULL, RX_BTCH_SUPPLIER_SEQ_NBR INTEGER NOT NULL,
SUPPLIER_PROC_ID BIGINT NOT NULL BTCH_NBR INTEGER NOT NULL RX_BTCH_SUPPLIER_SEQ_NBR INTEGER NOT NULL
DATA_TYP_CD BYTEINT NOT NULL, DATA_PD_CD BYTEINT NOT NULL,
DATA_TYP_CD BYTEINT NOT NULL DATA_PD_CD BYTEINT NOT NULL
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/14840953/how-to-remove-a-character-at-the-end-of-each-line-in-unix
How to remove a character at the end of each line in UNIX
Teja
jlliagre
14,840,982
67
true
so-14840953
qwen/qwen3.7-plus
null
null
so-1513861
Join every pair of consecutive lines into a single line separated by a space.
sed '$!N;s/\n/ /'
192.168.1.1 hostname1 192.168.1.2 hostname2 192.168.1.3 hostname3
192.168.1.1 hostname1 192.168.1.2 hostname2 192.168.1.3 hostname3
line1 line2 line3 line4
line1 line2 line3 line4
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/1513861/how-do-i-pair-every-two-lines-of-a-text-file-with-bash
How do I pair every two lines of a text file with Bash?
fwaechter
Tim
1,513,918
51
true
null
null
null
null
so-1513861-p1
Merge each pair of adjacent lines into a single line, using a space as the separator.
sed '$!N;s/\n/ /'
192.168.1.1 hostname1 192.168.1.2 hostname2 192.168.1.3 hostname3
192.168.1.1 hostname1 192.168.1.2 hostname2 192.168.1.3 hostname3
line1 line2 line3 line4
line1 line2 line3 line4
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/1513861/how-do-i-pair-every-two-lines-of-a-text-file-with-bash
How do I pair every two lines of a text file with Bash?
fwaechter
Tim
1,513,918
51
true
so-1513861
qwen/qwen3.7-plus
null
null
so-1538676
Capitalize the first letter of every word in each line.
sed -e "s/\b\(.\)/\u\1/g"
Trouble me Gold rush brides
Trouble Me Gold Rush Brides
hello world foo bar baz
Hello World Foo Bar Baz
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/1538676/uppercasing-first-letter-of-words-using-sed
Uppercasing First Letter of Words Using SED
neversaint
tangens
1,538,818
72
true
null
null
null
null
so-1538676-p1
Convert the first character of every word in each line to uppercase.
sed -e "s/\b\(.\)/\u\1/g"
Trouble me Gold rush brides
Trouble Me Gold Rush Brides
hello world foo bar baz
Hello World Foo Bar Baz
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/1538676/uppercasing-first-letter-of-words-using-sed
Uppercasing First Letter of Words Using SED
neversaint
tangens
1,538,818
72
true
so-1538676
qwen/qwen3.7-plus
null
null
so-16154007
Replace all double quotes with single quotes in the input text.
sed "s/\"/'/g"
<a href="#" id="resendActivationMailLink">here</a>
<a href='#' id='resendActivationMailLink'>here</a>
echo "test \"quoted\" value"
echo 'test \'quoted\' value'
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/16154007/replace-all-double-quotes-with-single-quotes
Replace all double quotes with single quotes
Zounadire
user142162
16,154,029
66
true
null
null
null
null
so-16154007-p1
Substitute all double quote characters with single quotes throughout the input.
sed "s/\"/'/g"
<a href="#" id="resendActivationMailLink">here</a>
<a href='#' id='resendActivationMailLink'>here</a>
echo "test \"quoted\" value"
echo 'test \'quoted\' value'
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/16154007/replace-all-double-quotes-with-single-quotes
Replace all double quotes with single quotes
Zounadire
user142162
16,154,029
66
true
so-16154007
qwen/qwen3.7-plus
null
null
so-16715373
Insert the text 'Hello world!!' immediately after any line containing the pattern '<tag>'.
sed '/<tag>/ a\Hello world!!'
<html> <body> <tag> </tag> </body> </html>
<html> <body> <tag> Hello world!! </tag> </body> </html>
<root> <tag> close </root>
<root> <tag> Hello world!! close </root>
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/16715373/insert-contents-of-a-file-after-specific-pattern-match
Insert contents of a file after specific pattern match
Satish
Birei
16,715,488
34
true
null
null
null
null
so-16715373-p1
Add the string 'Hello world!!' on a new line immediately following any line that matches the pattern '<tag>'.
sed '/<tag>/ a\Hello world!!'
<html> <body> <tag> </tag> </body> </html>
<html> <body> <tag> Hello world!! </tag> </body> </html>
<root> <tag> close </root>
<root> <tag> Hello world!! close </root>
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/16715373/insert-contents-of-a-file-after-specific-pattern-match
Insert contents of a file after specific pattern match
Satish
Birei
16,715,488
34
true
so-16715373
qwen/qwen3.7-plus
null
null
so-1733692
Extract only the numeric digits found between 'abc' and 'xyz' on each line, printing nothing for lines that do not match.
sed -n 's/^.*abc\([0-9][0-9]*\)xyz.*$/\1/p'
a b c abc12345xyz a b c
12345
no match here abc9xyz abcxyz
9
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/1733692/how-to-use-sed-awk-or-gawk-to-print-only-what-is-matched
how to use sed, awk, or gawk to print only what is matched?
St&#233;phane
mouviciel
1,733,727
102
true
null
null
null
null
so-1733692-p1
For each line, extract and print only the digits located between 'abc' and 'xyz'; output nothing for non-matching lines.
sed -n 's/^.*abc\([0-9][0-9]*\)xyz.*$/\1/p'
a b c abc12345xyz a b c
12345
no match here abc9xyz abcxyz
9
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/1733692/how-to-use-sed-awk-or-gawk-to-print-only-what-is-matched
how to use sed, awk, or gawk to print only what is matched?
St&#233;phane
mouviciel
1,733,727
102
true
so-1733692
qwen/qwen3.7-plus
null
null
so-17364951
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.
sed '0,/^bin$/d'
bin boot dev etc home
boot dev etc home
aaa bin boot ccc
boot ccc
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/17364951/remove-all-lines-before-a-match-with-sed
Remove all lines before a match with sed
Fabio
Endoro
17,365,103
69
true
null
null
null
null
so-17364951-p1
Remove all lines from the start of the input through the first line matching the pattern '^bin$', inclusive.
sed '0,/^bin$/d'
bin boot dev etc home
boot dev etc home
aaa bin boot ccc
boot ccc
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/17364951/remove-all-lines-before-a-match-with-sed
Remove all lines before a match with sed
Fabio
Endoro
17,365,103
69
true
so-17364951
qwen/qwen3.7-plus
null
null
so-1797906
Delete lines containing the string 'timebomb' from the input text using a colon as the delimiter for the address pattern.
sed '\:timebomb:d'
00 30 * * * /opt/timebomb.sh >> timebomb.log 01 30 * * * /opt/reincarnate.sh >> reincarnation.log
01 30 * * * /opt/reincarnate.sh >> reincarnation.log
keep this line delete timebomb here another keeper
keep this line another keeper
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/1797906/delete-using-a-different-delimiter-with-sed
Delete using a different delimiter with Sed
calvinkrishy
Stobor
1,797,967
44
true
null
null
null
null
so-1797906-p1
Use a colon as the address delimiter to remove any lines containing the string 'timebomb'.
sed '\:timebomb:d'
00 30 * * * /opt/timebomb.sh >> timebomb.log 01 30 * * * /opt/reincarnate.sh >> reincarnation.log
01 30 * * * /opt/reincarnate.sh >> reincarnation.log
keep this line delete timebomb here another keeper
keep this line another keeper
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/1797906/delete-using-a-different-delimiter-with-sed
Delete using a different delimiter with Sed
calvinkrishy
Stobor
1,797,967
44
true
so-1797906
qwen/qwen3.7-plus
null
null
so-17998763
Comment out lines containing the string 'BBB' by prepending a '#' character, but only if the line does not already start with a '#'.
sed -e '/BBB/ s/^#*/#/'
AAA BBB CCC
AAA #BBB CCC
# BBB BBB # Already commented BBB
# BBB #BBB # Already commented BBB
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/17998763/sed-commenting-a-line-matching-a-specific-string-and-that-is-not-already-comme
sed - Commenting a line matching a specific string AND that is not already commented out
Jean-Francois Chevrette
aragaer
17,999,003
98
true
null
null
null
null
so-17998763-p1
Prepend '#' to lines containing 'BBB' to comment them out, but skip lines that already begin with '#'.
sed -e '/BBB/ s/^#*/#/'
AAA BBB CCC
AAA #BBB CCC
# BBB BBB # Already commented BBB
# BBB #BBB # Already commented BBB
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/17998763/sed-commenting-a-line-matching-a-specific-string-and-that-is-not-already-comme
sed - Commenting a line matching a specific string AND that is not already commented out
Jean-Francois Chevrette
aragaer
17,999,003
98
true
so-17998763
qwen/qwen3.7-plus
null
null
so-18166552
Delete all lines from the beginning of the input up to and including the first line that contains the string 'yahoo'.
sed '1,/yahoo/d'
http://www.google.com http://www.bing.com http://www.yahoo.com http://www.baidu.com http://www.yandex.com
http://www.baidu.com http://www.yandex.com
alpha beta gamma yahoo delta epsilon zeta
epsilon zeta
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/18166552/grep-a-print-everything-after-a-match
&#39;grep +A&#39;: print everything after a match
B.Mr.W.
Hai Vu
18,166,628
38
true
null
null
null
null
so-18166552-p1
Delete all lines from the beginning of the file up to and including the first line that contains 'yahoo'.
sed '1,/yahoo/d'
http://www.google.com http://www.bing.com http://www.yahoo.com http://www.baidu.com http://www.yandex.com
http://www.baidu.com http://www.yandex.com
alpha beta gamma yahoo delta epsilon zeta
epsilon zeta
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/18166552/grep-a-print-everything-after-a-match
&#39;grep +A&#39;: print everything after a match
B.Mr.W.
Hai Vu
18,166,628
38
true
so-18166552
qwen/qwen3.7-plus
null
null
so-18234378
Replace every occurrence of the colon character ':' with a newline character to split the string into multiple lines.
sed 's/:/\n/g'
string1:string2:string3:string4:string5
string1 string2 string3 string4 string5
he:llo:you
he llo you
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/18234378/using-sed-to-split-a-string-with-a-delimiter
Using sed to split a string with a delimiter
nullByteMe
fedorqui
18,234,407
69
true
null
null
null
null
so-18234378-p1
Replace every instance of ':' with a newline character to break the string into separate lines.
sed 's/:/\n/g'
string1:string2:string3:string4:string5
string1 string2 string3 string4 string5
he:llo:you
he llo you
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/18234378/using-sed-to-split-a-string-with-a-delimiter
Using sed to split a string with a delimiter
nullByteMe
fedorqui
18,234,407
69
true
so-18234378
qwen/qwen3.7-plus
null
null
so-18397698
Extract the substring after the last colon character on each line.
sed 's/.*://'
server@10.200.200.20:/home/some/directory/file user:host:path/to/file simple:text
/home/some/directory/file path/to/file text
key:value:extra no_colon_here a:b:c:d
extra no_colon_here d
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/18397698/how-to-cut-a-string-after-a-specific-character-in-unix
How to cut a string after a specific character in unix
canecse
falsetru
18,397,722
41
true
null
null
null
null
so-18397698-p1
For every line, extract the text segment that follows the final colon.
sed 's/.*://'
server@10.200.200.20:/home/some/directory/file user:host:path/to/file simple:text
/home/some/directory/file path/to/file text
key:value:extra no_colon_here a:b:c:d
extra no_colon_here d
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/18397698/how-to-cut-a-string-after-a-specific-character-in-unix
How to cut a string after a specific character in unix
canecse
falsetru
18,397,722
41
true
so-18397698
qwen/qwen3.7-plus
null
null
so-1853009
Replace every sequence of one or more space or tab characters with a newline character.
sed -e 's/[[:blank:]]\+/\n/g'
word1 word2 word3 alpha beta
word1 word2 word3 alpha beta
one two three
one two three
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/1853009/replace-all-whitespace-with-a-line-break-paragraph-mark-to-make-a-word-list
Replace all whitespace with a line break/paragraph mark to make a word list
DavidR
Greg Bacon
1,853,040
73
true
null
null
null
null
so-1853009-p1
Substitute any run of spaces or tabs with a newline character.
sed -e 's/[[:blank:]]\+/\n/g'
word1 word2 word3 alpha beta
word1 word2 word3 alpha beta
one two three
one two three
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/1853009/replace-all-whitespace-with-a-line-break-paragraph-mark-to-make-a-word-list
Replace all whitespace with a line break/paragraph mark to make a word list
DavidR
Greg Bacon
1,853,040
73
true
so-1853009
qwen/qwen3.7-plus
null
null
so-18620153
Replace the line immediately following a line containing '<key>ConnectionString</key>' with '<string>changed_value</string>'.
sed '/<key>ConnectionString<\/key>/!b;n;c<string>changed_value</string>'
<key>OtherKey</key> <string>keep_this</string> <key>ConnectionString</key> <string>anything_could_be_here</string> <key>AnotherKey</key> <string>keep_this_too</string>
<key>OtherKey</key> <string>keep_this</string> <key>ConnectionString</key> <string>changed_value</string> <key>AnotherKey</key> <string>keep_this_too</string>
<key>ConnectionString</key> <string>old_value</string> <key>Other</key> <string>val</string>
<key>ConnectionString</key> <string>changed_value</string> <key>Other</key> <string>val</string>
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/18620153/find-matching-text-and-replace-next-line
find matching text and replace next line
bswinnerton
potong
18,622,953
70
true
null
null
null
null
so-18620153-p1
If a line contains '<key>ConnectionString</key>', replace the subsequent line with '<string>changed_value</string>'.
sed '/<key>ConnectionString<\/key>/!b;n;c<string>changed_value</string>'
<key>OtherKey</key> <string>keep_this</string> <key>ConnectionString</key> <string>anything_could_be_here</string> <key>AnotherKey</key> <string>keep_this_too</string>
<key>OtherKey</key> <string>keep_this</string> <key>ConnectionString</key> <string>changed_value</string> <key>AnotherKey</key> <string>keep_this_too</string>
<key>ConnectionString</key> <string>old_value</string> <key>Other</key> <string>val</string>
<key>ConnectionString</key> <string>changed_value</string> <key>Other</key> <string>val</string>
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/18620153/find-matching-text-and-replace-next-line
find matching text and replace next line
bswinnerton
potong
18,622,953
70
true
so-18620153
qwen/qwen3.7-plus
null
null
so-1898553
Replace each line with its first sequence of digits; leave lines without digits unchanged.
sed 's/[^0-9]*\([0-9]\+\).*/\1/'
TestT100String NoDigitsHere Prefix42Suffix
100 NoDigitsHere 42
ABC123XYZ 99Bottles TextOnly
123 99 TextOnly
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/1898553/return-a-regex-match-in-a-bash-script-instead-of-replacing-it
Return a regex match in a Bash script, instead of replacing it
Mint
Dennis Williamson
1,898,578
34
true
null
null
null
null
so-1898553-p1
Replace each line with its initial sequence of digits, preserving lines that lack digits as they are.
sed 's/[^0-9]*\([0-9]\+\).*/\1/'
TestT100String NoDigitsHere Prefix42Suffix
100 NoDigitsHere 42
ABC123XYZ 99Bottles TextOnly
123 99 TextOnly
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/1898553/return-a-regex-match-in-a-bash-script-instead-of-replacing-it
Return a regex match in a Bash script, instead of replacing it
Mint
Dennis Williamson
1,898,578
34
true
so-1898553
qwen/qwen3.7-plus
null
null
so-20521857
Remove all trailing whitespace (spaces and tabs) from the end of each line.
sed 's/[[:blank:]]*$//'
hello bye ha^I clean
hello bye ha^I clean
test line another
test line another
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/20521857/remove-white-space-from-the-end-of-line-in-linux
remove white space from the end of line in linux
aksg24
fedorqui
20,521,915
55
true
null
null
null
null
so-20521857-p1
Strip all trailing spaces and tabs from every line.
sed 's/[[:blank:]]*$//'
hello bye ha^I clean
hello bye ha^I clean
test line another
test line another
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/20521857/remove-white-space-from-the-end-of-line-in-linux
remove white space from the end of line in linux
aksg24
fedorqui
20,521,915
55
true
so-20521857
qwen/qwen3.7-plus
null
null
so-20521857-v1
Remove all trailing whitespace (spaces and tabs) from the end of each line.
sed 's/[[:blank:]]*$//'
data value clean end
data value clean end
alpha beta gamma delta
alpha beta gamma delta
real-stackoverflow
3
train
openrouter-input-variation
CC-BY-SA-4.0
https://stackoverflow.com/questions/20521857/remove-white-space-from-the-end-of-line-in-linux
remove white space from the end of line in linux
aksg24
fedorqui
20,521,915
55
true
null
null
so-20521857
qwen/qwen3.7-plus
so-20521857-v1-p1
Delete any whitespace consisting of spaces or tabs at the end of each line.
sed 's/[[:blank:]]*$//'
data value clean end
data value clean end
alpha beta gamma delta
alpha beta gamma delta
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/20521857/remove-white-space-from-the-end-of-line-in-linux
remove white space from the end of line in linux
aksg24
fedorqui
20,521,915
55
true
so-20521857-v1
qwen/qwen3.7-plus
so-20521857
qwen/qwen3.7-plus
so-20871534
Join all lines of input into a single line, replacing newlines with a single space.
sed ':a;N;s/\n/ /;ba'
The quick brown fox
The quick brown fox
Hello World Test
Hello World Test
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/20871534/concatenate-in-bash-the-output-of-two-commands-without-newline-character
Concatenate in bash the output of two commands without newline character
synaptik
anubhava
20,871,567
77
true
null
null
null
null
so-20871534-p1
Merge all input lines into one continuous line by substituting newlines with a single space.
sed ':a;N;s/\n/ /;ba'
The quick brown fox
The quick brown fox
Hello World Test
Hello World Test
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/20871534/concatenate-in-bash-the-output-of-two-commands-without-newline-character
Concatenate in bash the output of two commands without newline character
synaptik
anubhava
20,871,567
77
true
so-20871534
qwen/qwen3.7-plus
null
null
so-20871534-v1
Join all lines of input into a single line, replacing newlines with a single space.
sed ':a;N;s/\n/ /;ba'
Hello World Foo Bar
Hello World Foo Bar
One Two Three
One Two Three
real-stackoverflow
3
train
openrouter-input-variation
CC-BY-SA-4.0
https://stackoverflow.com/questions/20871534/concatenate-in-bash-the-output-of-two-commands-without-newline-character
Concatenate in bash the output of two commands without newline character
synaptik
anubhava
20,871,567
77
true
null
null
so-20871534
qwen/qwen3.7-plus
so-20871534-v1-p1
Combine all lines into a single string, using a space in place of each newline.
sed ':a;N;s/\n/ /;ba'
Hello World Foo Bar
Hello World Foo Bar
One Two Three
One Two Three
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/20871534/concatenate-in-bash-the-output-of-two-commands-without-newline-character
Concatenate in bash the output of two commands without newline character
synaptik
anubhava
20,871,567
77
true
so-20871534-v1
qwen/qwen3.7-plus
so-20871534
qwen/qwen3.7-plus
so-20943025
Print lines starting from the first occurrence of 'trigger' up to and including the second occurrence of 'trigger', then stop processing.
sed -n '/trigger/{p; :loop n; p; /trigger/q; b loop}'
header trigger text1 text2 trigger text5 trigger
trigger text1 text2 trigger
start trigger line A line B trigger end
trigger line A line B trigger
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/20943025/how-can-i-get-sed-to-quit-after-the-first-matching-address-range
how can I get sed to quit after the first matching address range?
PonyEars
janos
20,943,542
38
true
null
null
null
null
so-20943025-p1
Output lines beginning with the first instance of 'trigger' through the second instance of 'trigger', inclusive, then halt.
sed -n '/trigger/{p; :loop n; p; /trigger/q; b loop}'
header trigger text1 text2 trigger text5 trigger
trigger text1 text2 trigger
start trigger line A line B trigger end
trigger line A line B trigger
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/20943025/how-can-i-get-sed-to-quit-after-the-first-matching-address-range
how can I get sed to quit after the first matching address range?
PonyEars
janos
20,943,542
38
true
so-20943025
qwen/qwen3.7-plus
null
null
so-20943025-v1
Print lines starting from the first occurrence of 'trigger' up to and including the second occurrence of 'trigger', then stop processing.
sed -n '/trigger/{p; :loop n; p; /trigger/q; b loop}'
start trigger middle1 middle2 trigger end
trigger middle1 middle2 trigger
pre trigger lineA lineB trigger post
trigger lineA lineB trigger
real-stackoverflow
3
train
openrouter-input-variation
CC-BY-SA-4.0
https://stackoverflow.com/questions/20943025/how-can-i-get-sed-to-quit-after-the-first-matching-address-range
how can I get sed to quit after the first matching address range?
PonyEars
janos
20,943,542
38
true
null
null
so-20943025
qwen/qwen3.7-plus
so-20943025-v1-p1
Start printing at the first appearance of 'trigger' and continue until the second appearance is included, then cease processing.
sed -n '/trigger/{p; :loop n; p; /trigger/q; b loop}'
start trigger middle1 middle2 trigger end
trigger middle1 middle2 trigger
pre trigger lineA lineB trigger post
trigger lineA lineB trigger
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/20943025/how-can-i-get-sed-to-quit-after-the-first-matching-address-range
how can I get sed to quit after the first matching address range?
PonyEars
janos
20,943,542
38
true
so-20943025-v1
qwen/qwen3.7-plus
so-20943025
qwen/qwen3.7-plus
so-21309020
Remove all odd-numbered lines from the input text, keeping only the even-numbered lines.
sed '1d; n; d'
Line 1 Line 2 Line 3 Line 4
Line 2 Line 4
Alpha Beta Gamma Delta Epsilon
Beta Delta
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/21309020/remove-odd-or-even-lines-from-a-text-file
Remove odd or even lines from a text file
SamuelNLP
Thor
21,309,073
53
true
null
null
null
null
so-21309020-p1
Filter out all odd-numbered lines, retaining only those at even positions.
sed '1d; n; d'
Line 1 Line 2 Line 3 Line 4
Line 2 Line 4
Alpha Beta Gamma Delta Epsilon
Beta Delta
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/21309020/remove-odd-or-even-lines-from-a-text-file
Remove odd or even lines from a text file
SamuelNLP
Thor
21,309,073
53
true
so-21309020
qwen/qwen3.7-plus
null
null
so-21309020-v1
Remove all odd-numbered lines from the input text, keeping only the even-numbered lines.
sed '1d; n; d'
A B C D E F
B D F
1 2 3 4 5 6
2 4 6
real-stackoverflow
3
train
openrouter-input-variation
CC-BY-SA-4.0
https://stackoverflow.com/questions/21309020/remove-odd-or-even-lines-from-a-text-file
Remove odd or even lines from a text file
SamuelNLP
Thor
21,309,073
53
true
null
null
so-21309020
qwen/qwen3.7-plus
so-21309020-v1-p1
Discard lines at odd indices, keeping only the even-numbered lines.
sed '1d; n; d'
A B C D E F
B D F
1 2 3 4 5 6
2 4 6
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/21309020/remove-odd-or-even-lines-from-a-text-file
Remove odd or even lines from a text file
SamuelNLP
Thor
21,309,073
53
true
so-21309020-v1
qwen/qwen3.7-plus
so-21309020
qwen/qwen3.7-plus
so-2157288
Delete any line containing the pattern 'pattern' case-insensitively.
sed '/pattern/Id'
Keep this Remove Pattern here Keep this too remove PATTERN now
Keep this Keep this too
Case Sensitive Line Ignore pattern match Another Line
Case Sensitive Line Another Line
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/2157288/using-sed-to-delete-a-case-insensitive-matched-line
Using sed to delete a case insensitive matched line
eruina
Mark Byers
2,157,363
48
true
null
null
null
null
so-2157288-p1
Filter out any line that matches the case-insensitive pattern 'pattern'.
sed '/pattern/Id'
Keep this Remove Pattern here Keep this too remove PATTERN now
Keep this Keep this too
Case Sensitive Line Ignore pattern match Another Line
Case Sensitive Line Another Line
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/2157288/using-sed-to-delete-a-case-insensitive-matched-line
Using sed to delete a case insensitive matched line
eruina
Mark Byers
2,157,363
48
true
so-2157288
qwen/qwen3.7-plus
null
null
so-22497246
Insert the lines 'line1', 'line2', 'line3', and 'line4' after every line containing the pattern 'cdef'.
sed '/cdef/a\line1\nline2\nline3\nline4'
abcd accd cdef line web
abcd accd cdef line1 line2 line3 line4 line web
start cdef end
start cdef line1 line2 line3 line4 end
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/22497246/insert-multiple-lines-into-a-file-after-specified-pattern-using-shell-script
Insert multiple lines into a file after specified pattern using shell script
user27
sat
22,497,499
102
true
null
null
null
null
so-22497246-p1
After each line containing 'cdef', insert the lines 'line1', 'line2', 'line3', and 'line4'.
sed '/cdef/a\line1\nline2\nline3\nline4'
abcd accd cdef line web
abcd accd cdef line1 line2 line3 line4 line web
start cdef end
start cdef line1 line2 line3 line4 end
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/22497246/insert-multiple-lines-into-a-file-after-specified-pattern-using-shell-script
Insert multiple lines into a file after specified pattern using shell script
user27
sat
22,497,499
102
true
so-22497246
qwen/qwen3.7-plus
null
null
so-2310605
Remove all leading whitespace (spaces and tabs) from each line of the input text.
sed 's/^[ \t]*//'
for (i = 0; i < 100; i++) for (i = 0; i < 100; i++) for (i = 0; i < 100; i++)
for (i = 0; i < 100; i++) for (i = 0; i < 100; i++) for (i = 0; i < 100; i++)
indented line mixed spaces and tabs no indent
indented line mixed spaces and tabs no indent
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/2310605/how-to-remove-leading-whitespace-from-each-line-in-a-file
How to remove leading whitespace from each line in a file
Lazer
shuvalov
2,310,620
83
true
null
null
null
null
so-2310605-p1
Strip all leading spaces and tabs from every line in the input.
sed 's/^[ \t]*//'
for (i = 0; i < 100; i++) for (i = 0; i < 100; i++) for (i = 0; i < 100; i++)
for (i = 0; i < 100; i++) for (i = 0; i < 100; i++) for (i = 0; i < 100; i++)
indented line mixed spaces and tabs no indent
indented line mixed spaces and tabs no indent
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/2310605/how-to-remove-leading-whitespace-from-each-line-in-a-file
How to remove leading whitespace from each line in a file
Lazer
shuvalov
2,310,620
83
true
so-2310605
qwen/qwen3.7-plus
null
null
so-2369314
Replace every backslash character with a forward slash in the input text.
sed 's/\\/\//g'
sample_input\whatever
sample_input/whatever
path\to\file
path/to/file
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/2369314/why-does-sed-require-3-backslashes-for-a-regular-backslash
Why does sed require 3 backslashes for a regular backslash?
Geo
Dennis Williamson
2,372,693
56
true
null
null
null
null
so-2369314-p1
Substitute every backslash with a forward slash throughout the text.
sed 's/\\/\//g'
sample_input\whatever
sample_input/whatever
path\to\file
path/to/file
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/2369314/why-does-sed-require-3-backslashes-for-a-regular-backslash
Why does sed require 3 backslashes for a regular backslash?
Geo
Dennis Williamson
2,372,693
56
true
so-2369314
qwen/qwen3.7-plus
null
null
so-24230117
Prepend a '#' character to the beginning of any line that contains the pattern '000'.
sed 's/.*000/#&/'
This is a 000 line. This is 000 yet ano000ther line. This is still yet another line.
#This is a 000 line. #This is 000 yet ano000ther line. This is still yet another line.
no match here match 000 here another 000 test
no match here #match 000 here #another 000 test
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/24230117/how-to-add-a-before-any-line-containing-a-matching-pattern-in-bash
How to add a # before any line containing a matching pattern in BASH?
Village
potong
24,233,771
37
true
null
null
null
null
so-24889346
Uncomment lines that start with a hash symbol and contain the string ' 2001 ' by removing the leading hash symbol.
sed '/^#.* 2001 /s/^#//'
#-A INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 2002 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 2002 -j ACCEPT
# Commented line with 2001 # Another comment Active line with 2001 here
Commented line with 2001 # Another comment Active line with 2001 here
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/24889346/how-to-uncomment-a-line-that-contains-a-specific-string-using-sed
How to UNCOMMENT a line that contains a specific string using Sed?
user3864928
Avinash Raj
24,889,374
80
true
null
null
null
null
so-24889346-p1
Uncomment lines beginning with a hash that include ' 2001 ' by stripping the leading '#'.
sed '/^#.* 2001 /s/^#//'
#-A INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 2002 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 2002 -j ACCEPT
# Commented line with 2001 # Another comment Active line with 2001 here
Commented line with 2001 # Another comment Active line with 2001 here
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/24889346/how-to-uncomment-a-line-that-contains-a-specific-string-using-sed
How to UNCOMMENT a line that contains a specific string using Sed?
user3864928
Avinash Raj
24,889,374
80
true
so-24889346
qwen/qwen3.7-plus
null
null
so-2560411
Remove every odd-numbered line from the input text, keeping only the even-numbered lines.
sed '1~2d'
remove keep remove keep remove
keep keep
line1 line2 line3 line4
line2 line4
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/2560411/how-to-remove-every-other-line-with-sed
How to remove every other line with sed?
hhh
ghostdog74
2,560,448
64
true
null
null
null
null
so-2560411-p1
Discard all odd-numbered lines, retaining only the even-numbered ones.
sed '1~2d'
remove keep remove keep remove
keep keep
line1 line2 line3 line4
line2 line4
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/2560411/how-to-remove-every-other-line-with-sed
How to remove every other line with sed?
hhh
ghostdog74
2,560,448
64
true
so-2560411
qwen/qwen3.7-plus
null
null
so-26081375
Delete lines containing 'This' within the line range 3 to 6, ensuring POSIX compatibility with a semicolon.
sed -e '3,6 { /This/d; }'
This is my cat my cat's name is betty This is your dog your dog's name is frank This is your fish your fish's name is george This is my goat my goat's name is adam
This is my cat my cat's name is betty your dog's name is frank your fish's name is george This is my goat my goat's name is adam
Line 1 Line 2 This is line 3 Line 4 This is line 5 Line 6 Line 7
Line 1 Line 2 Line 4 Line 6 Line 7
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/26081375/bsd-sed-extra-characters-at-the-end-of-d-command
BSD sed: extra characters at the end of d command
lutaoact
Jonathan Leffler
26,081,763
52
true
null
null
null
null
so-26081375-p1
Within lines 3 through 6, delete those containing 'This', using a semicolon for POSIX compliance.
sed -e '3,6 { /This/d; }'
This is my cat my cat's name is betty This is your dog your dog's name is frank This is your fish your fish's name is george This is my goat my goat's name is adam
This is my cat my cat's name is betty your dog's name is frank your fish's name is george This is my goat my goat's name is adam
Line 1 Line 2 This is line 3 Line 4 This is line 5 Line 6 Line 7
Line 1 Line 2 Line 4 Line 6 Line 7
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/26081375/bsd-sed-extra-characters-at-the-end-of-d-command
BSD sed: extra characters at the end of d command
lutaoact
Jonathan Leffler
26,081,763
52
true
so-26081375
qwen/qwen3.7-plus
null
null
so-2652494
Extract the first column from a comma-separated values stream, removing everything after the first comma on each line.
sed 's/,.*//'
EXAMPLEfoo,60,6 EXAMPLEbar,30,6 EXAMPLE1,60,3
EXAMPLEfoo EXAMPLEbar EXAMPLE1
Name,Value,Extra Test,123,abc
Name Test
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/2652494/parsing-the-first-column-of-a-csv-file-to-a-new-file
Parsing the first column of a csv file to a new file
S1syphus
Thomas
2,652,526
50
true
null
null
null
null
so-2652494-p1
From a CSV stream, keep only the first column by truncating each line at the first comma.
sed 's/,.*//'
EXAMPLEfoo,60,6 EXAMPLEbar,30,6 EXAMPLE1,60,3
EXAMPLEfoo EXAMPLEbar EXAMPLE1
Name,Value,Extra Test,123,abc
Name Test
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/2652494/parsing-the-first-column-of-a-csv-file-to-a-new-file
Parsing the first column of a csv file to a new file
S1syphus
Thomas
2,652,526
50
true
so-2652494
qwen/qwen3.7-plus
null
null
so-27305177
Remove the last character from the last line of the input stream.
sed '$ s/.$//'
sometext moretext lastline
sometext moretext lastlin
line one line two
line one line tw
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/27305177/how-can-i-remove-the-last-non-newline-character-of-a-file-in-unix
How can I remove the last (non-newline) character of a file in unix?
MaxPRafferty
mklement0
27,327,973
101
true
null
null
null
null
so-27305177-p1
Delete the final character of the last line in the input stream.
sed '$ s/.$//'
sometext moretext lastline
sometext moretext lastlin
line one line two
line one line tw
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/27305177/how-can-i-remove-the-last-non-newline-character-of-a-file-in-unix
How can I remove the last (non-newline) character of a file in unix?
MaxPRafferty
mklement0
27,327,973
101
true
so-27305177
qwen/qwen3.7-plus
null
null
so-2957094
Print only lines whose first two whitespace-separated fields are a number and a value starting with 'LINUX'.
sed -n -e '/^[0-9][0-9]* LINUX/p'
1 LINUX param1 value1 2 LINUXparam2 value2 3 SOLARIS param3 value3 4 SOLARIS param4 value4
1 LINUX param1 value1 2 LINUXparam2 value2
10 LINUX test 5 UNIX test 123 LINUX foo
10 LINUX test 123 LINUX foo
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/2957094/how-to-use-awk-to-print-lines-where-a-field-matches-a-specific-string
How to use awk to print lines where a field matches a specific string?
yael
Hank Gay
2,957,225
71
true
null
null
null
null
so-2957094-p1
Output only lines where the first two whitespace-delimited fields consist of a number and a value starting with 'LINUX'.
sed -n -e '/^[0-9][0-9]* LINUX/p'
1 LINUX param1 value1 2 LINUXparam2 value2 3 SOLARIS param3 value3 4 SOLARIS param4 value4
1 LINUX param1 value1 2 LINUXparam2 value2
10 LINUX test 5 UNIX test 123 LINUX foo
10 LINUX test 123 LINUX foo
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/2957094/how-to-use-awk-to-print-lines-where-a-field-matches-a-specific-string
How to use awk to print lines where a field matches a specific string?
yael
Hank Gay
2,957,225
71
true
so-2957094
qwen/qwen3.7-plus
null
null
so-29613304
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.
sed 's/[^^]/[&]/g; s/\^/\\^/g'
[a-z]\+
[[][a][-][z][]][\][+]
^test$.*
\^[t][e][s][t][$][.][*]
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed
Is it possible to escape regex metacharacters reliably with sed
hek2mgl
mklement0
29,613,573
91
true
null
null
null
null
so-29613304-p1
Sanitize the input string for literal regex usage by wrapping non-caret characters in individual character classes and escaping carets.
sed 's/[^^]/[&]/g; s/\^/\\^/g'
[a-z]\+
[[][a][-][z][]][\][+]
^test$.*
\^[t][e][s][t][$][.][*]
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed
Is it possible to escape regex metacharacters reliably with sed
hek2mgl
mklement0
29,613,573
91
true
so-29613304
qwen/qwen3.7-plus
null
null
so-30179484
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.
sed -n '/^[[:space:]]*[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}[[:space:]]*$/ h;${g;p;}'
2.1.0-dev 2.1.4 2.2.0-rc1 2.2.2 jruby-1.7.19
2.2.2
1.0.0-alpha 1.0.1 1.1.0-beta 1.1.2 maglev-1.0.0
1.1.2
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/30179484/install-latest-stable-version-of-ruby-using-rbenv
Install Latest Stable Version of Ruby Using rbenv
user636044
NeronLeVelu
30,183,040
53
true
null
null
null
null
so-30179484-p1
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.
sed -n '/^[[:space:]]*[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}[[:space:]]*$/ h;${g;p;}'
2.1.0-dev 2.1.4 2.2.0-rc1 2.2.2 jruby-1.7.19
2.2.2
1.0.0-alpha 1.0.1 1.1.0-beta 1.1.2 maglev-1.0.0
1.1.2
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/30179484/install-latest-stable-version-of-ruby-using-rbenv
Install Latest Stable Version of Ruby Using rbenv
user636044
NeronLeVelu
30,183,040
53
true
so-30179484
qwen/qwen3.7-plus
null
null
so-32569032
For lines matching the pattern 'pattern', remove everything up to and including 'text='.
sed '/pattern/s/.*text=//'
[01/09/2015] INFO=123 text=hi my number status=new [01/09/2015] INFO=456 text=hello world status=old
[01/09/2015] INFO=123 text=hi my number status=new [01/09/2015] INFO=456 text=hello world status=old
no match here match pattern text=extract this status=done
no match here extract this status=done
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/32569032/sed-how-to-print-all-lines-after-line-with-a-match
sed : how to print all lines after line with a match?
hawarden_
tripleee
32,581,300
43
true
null
null
null
null
so-32569032-p1
For any line matching 'pattern', strip away all content up to and including the substring 'text='.
sed '/pattern/s/.*text=//'
[01/09/2015] INFO=123 text=hi my number status=new [01/09/2015] INFO=456 text=hello world status=old
[01/09/2015] INFO=123 text=hi my number status=new [01/09/2015] INFO=456 text=hello world status=old
no match here match pattern text=extract this status=done
no match here extract this status=done
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/32569032/sed-how-to-print-all-lines-after-line-with-a-match
sed : how to print all lines after line with a match?
hawarden_
tripleee
32,581,300
43
true
so-32569032
qwen/qwen3.7-plus
null
null
so-3350223
Remove all comment lines (lines starting with optional whitespace followed by '#') and all empty lines from the input text using a single sed command.
sed '/^[[:space:]]*#/d;/^$/d'
# This is a comment Line 1 # Another comment Line 2 # Indented comment Line 3
Line 1 Line 2 Line 3
Hello World # Comment Test
Hello World Test
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/3350223/sed-remove-and-empty-lines-with-one-sed-command
sed + remove &quot;#&quot; and empty lines with one sed command
lidia
paxdiablo
3,350,246
36
true
null
null
null
null
End of preview. Expand in Data Studio

Sedweave Real Data

Natural-language-to-sed tasks derived from highly voted Stack Overflow questions and accepted answers, with disjoint training, development, and frozen-test questions. This dataset supports generalization-focused training and evaluation beyond Sedweave's synthetic task families.

Splits

Split Rows Purpose
Train 157 75 unique reviewed tasks, 4 input variations, and 78 guarded paraphrases
Validation 42 Initial real-question development benchmark; never used for training
Test 37 Frozen questions from disjoint lower-vote sources

The source questions are unique across all splits. There is zero input-text or request/command overlap between splits or with asterbraid/sedweave-data. The original 42-task asterbraid/sedweave-so-data benchmark is preserved separately and appears here as the validation split.

Every reference command was executed on two inputs with /usr/bin/sed (GNU sed) 4.9: 472 successful executions, 0 errors. Commands start with sed, read one stream on stdin, and avoid filenames, in-place edits, file commands, pipelines, and shell execution. Some authentic solutions use GNU sed extensions.

Source and attribution

Each row includes question_url, question_title, question_owner, answer_owner, and answer_id. ATTRIBUTION.md lists every source. Requests are self-contained instructions derived from questions and accepted answers; commands are executable solutions. Request-to-command intent was manually reviewed. Paraphrases and input variations were generated only for training rows and passed literal-preservation and execution checks.

from datasets import load_dataset

train = load_dataset("asterbraid/sedweave-real-data", split="train")
test = load_dataset("asterbraid/sedweave-real-data", split="test")

Model evaluation

Greedy generation, one prediction per row. Valid means the command executes; correct requires exact output on both inputs. Only trailing special tokens are removed.

Model Validation valid Validation correct Frozen-test valid Frozen-test correct
Original Sedweave 0.5B 71.4% (30/42) 23.8% (10/42) 89.2% (33/37) 18.9% (7/37)
Unselected generalization-tuned 0.5B candidate 76.2% (32/42) 23.8% (10/42) 83.8% (31/37) 18.9% (7/37)
Sedweave 1.5B 90.5% (38/42) 52.4% (22/42) 97.3% (36/37) 35.1% (13/37)

Full predictions and summaries are included under evaluation/.

The generalization-tuned 0.5B candidate was not released: frozen validity decreased and frozen correctness did not improve. Its training settings are in candidate_training_config.json.

Sedweave 1.5B is the recommended model because it improves both validity and correctness on the development and frozen real-question sets.

Limitations

This is a small, high-vote sample, not a representative benchmark of all sed use. Tasks were selected for compatibility with single-stream input and the safety guard. Exact outputs on two representative inputs do not prove correctness on every possible input. Some requests or commands may be ambiguous outside their original context.

License

Original Stack Overflow content and these derived rows are CC BY-SA 4.0. See SO_DATASET_LICENSE.txt and ATTRIBUTION.md. Included collection, conversion, review, expansion, and validation code is Apache-2.0.

Downloads last month
49

Models trained or fine-tuned on asterbraid/sedweave-real-data

Collection including asterbraid/sedweave-real-data