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-3350223-p1
Use a single sed command to delete both empty lines and comment lines (those beginning with optional whitespace followed by '#') from the input.
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
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/3350223/sed-remove-and-empty-lines-with-one-sed-command
sed + remove "#" and empty lines with one sed command
lidia
paxdiablo
3,350,246
36
true
so-3350223
qwen/qwen3.7-plus
null
null
so-3434462
Print all lines from the first line matching 'match_line' to the end of the input.
sed -n '/match_line/,$p'
header match_line content footer
match_line content footer
line1 line2 match_line found end
match_line found end
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/3434462/print-lines-in-file-from-the-match-line-until-end-of-file
Print lines in file from the match line until end of file
lidia
ghostdog74
3,434,563
48
true
null
null
null
null
so-3434462-p1
Output every line starting from the first occurrence of 'match_line' through to the end of the file.
sed -n '/match_line/,$p'
header match_line content footer
match_line content footer
line1 line2 match_line found end
match_line found end
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/3434462/print-lines-in-file-from-the-match-line-until-end-of-file
Print lines in file from the match line until end of file
lidia
ghostdog74
3,434,563
48
true
so-3434462
qwen/qwen3.7-plus
null
null
so-35021524
Add a comma to the end of every line except the last line.
sed '$!s/$/,/'
{...} {...} {...} {...}
{...}, {...}, {...}, {...}
line1 line2 line3
line1, line2, line3
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/35021524/how-can-i-add-a-comma-at-the-end-of-every-line-except-the-last-line
How can I add a comma at the end of every line except the last line?
Joan Triay
tripleee
35,021,663
60
true
null
null
null
null
so-35021524-p1
Append a comma to the end of each line, excluding the very last line.
sed '$!s/$/,/'
{...} {...} {...} {...}
{...}, {...}, {...}, {...}
line1 line2 line3
line1, line2, line3
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/35021524/how-can-i-add-a-comma-at-the-end-of-every-line-except-the-last-line
How can I add a comma at the end of every line except the last line?
Joan Triay
tripleee
35,021,663
60
true
so-35021524
qwen/qwen3.7-plus
null
null
so-3795512
Remove the first five characters from every line that contains at least five characters.
sed 's/^.....//'
12345abcdef 12345ghijk short
abcdef ghijk
Hello World ABCDE12345 1234
World 12345 1234
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/3795512/delete-the-first-five-characters-on-any-line-of-a-text-file-in-linux-with-sed
Delete the first five characters on any line of a text file in Linux with sed
JBeg
PhilR
3,806,107
101
true
null
null
null
null
so-3795512-p1
Strip the first five characters from every line that has a length of at least five characters.
sed 's/^.....//'
12345abcdef 12345ghijk short
abcdef ghijk
Hello World ABCDE12345 1234
World 12345 1234
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/3795512/delete-the-first-five-characters-on-any-line-of-a-text-file-in-linux-with-sed
Delete the first five characters on any line of a text file in Linux with sed
JBeg
PhilR
3,806,107
101
true
so-3795512
qwen/qwen3.7-plus
null
null
so-3984824
Replace all occurrences of the percent sign '%' with a dollar sign '$' in the input text.
sed 's/%/$/g'
100% complete 50% done 0% left
100$ complete 50$ done 0$ left
Price is 100% Discount 20%
Price is 100$ Discount 20$
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/3984824/sed-command-in-bash
"sed" command in bash
ajsie
Jack Kelly
3,984,855
45
true
null
null
null
null
so-3984824-p1
Substitute every instance of the percent sign '%' with a dollar sign '$' throughout the text.
sed 's/%/$/g'
100% complete 50% done 0% left
100$ complete 50$ done 0$ left
Price is 100% Discount 20%
Price is 100$ Discount 20$
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/3984824/sed-command-in-bash
"sed" command in bash
ajsie
Jack Kelly
3,984,855
45
true
so-3984824
qwen/qwen3.7-plus
null
null
so-4348166
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.
sed -n 's/.*_\([0-9][0-9]*\)\(\.gz\)\{0,1\}$/\1/p'
file_1.gz file_2 data_99.gz.tar image_5.png
1 2
test_10.gz backup_3
10 3
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/4348166/using-with-sed
Using ? with sed
User1
Laurence Gonsalves
4,348,215
36
true
null
null
null
null
so-4348166-p1
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').
sed -n 's/.*_\([0-9][0-9]*\)\(\.gz\)\{0,1\}$/\1/p'
file_1.gz file_2 data_99.gz.tar image_5.png
1 2
test_10.gz backup_3
10 3
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/4348166/using-with-sed
Using ? with sed
User1
Laurence Gonsalves
4,348,215
36
true
so-4348166
qwen/qwen3.7-plus
null
null
so-4521162
Replace sequences of multiple consecutive empty lines with a single empty line.
sed '/^$/N;/^\n$/D'
Line 1 Line 2 Line 3
Line 1 Line 2 Line 3
Start End
Start End
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/4521162/can-i-use-the-sed-command-to-replace-multiple-empty-line-with-one-empty-line
Can I use the sed command to replace multiple empty line with one empty line?
Just a learner
Dennis Williamson
4,522,043
43
true
null
null
null
null
so-4521162-p1
Collapse any sequence of multiple consecutive blank lines into a single blank line.
sed '/^$/N;/^\n$/D'
Line 1 Line 2 Line 3
Line 1 Line 2 Line 3
Start End
Start End
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/4521162/can-i-use-the-sed-command-to-replace-multiple-empty-line-with-one-empty-line
Can I use the sed command to replace multiple empty line with one empty line?
Just a learner
Dennis Williamson
4,522,043
43
true
so-4521162
qwen/qwen3.7-plus
null
null
so-4953738
Replace all occurrences of 'foo' with 'bar' in lines that do NOT start with '##Input'.
sed '/^##Input/! s/foo/bar/g'
##Input foo baz foo is here another foo line
##Input foo baz bar is here another bar line
##Input foo foo bar foo start with foo
##Input foo bar bar bar start with bar
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/4953738/how-to-globally-replace-strings-in-lines-not-starting-with-a-certain-pattern
How to globally replace strings in lines NOT starting with a certain pattern
user438602
Dennis Williamson
4,953,824
63
true
null
null
null
null
so-4953738-p1
In lines that do not begin with '##Input', replace every instance of 'foo' with 'bar'.
sed '/^##Input/! s/foo/bar/g'
##Input foo baz foo is here another foo line
##Input foo baz bar is here another bar line
##Input foo foo bar foo start with foo
##Input foo bar bar bar start with bar
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/4953738/how-to-globally-replace-strings-in-lines-not-starting-with-a-certain-pattern
How to globally replace strings in lines NOT starting with a certain pattern
user438602
Dennis Williamson
4,953,824
63
true
so-4953738
qwen/qwen3.7-plus
null
null
so-5047165
Replace the first occurrence of the word 'two' and everything following it on each line with the word 'BLAH'.
sed 's/two.*/BLAH/'
one two three five four two five five six six one two seven four
one BLAH four BLAH six one BLAH
start two end no match here two at start
start BLAH no match here BLAH
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/5047165/replacing-from-match-to-end-of-line
Replacing from match to end-of-line
GregH
Andrew Clark
5,047,180
51
true
null
null
null
null
so-5047165-p1
On each line, replace the first occurrence of the word 'two' and all subsequent text with 'BLAH'.
sed 's/two.*/BLAH/'
one two three five four two five five six six one two seven four
one BLAH four BLAH six one BLAH
start two end no match here two at start
start BLAH no match here BLAH
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/5047165/replacing-from-match-to-end-of-line
Replacing from match to end-of-line
GregH
Andrew Clark
5,047,180
51
true
so-5047165
qwen/qwen3.7-plus
null
null
so-5864146
Replace the string '/foo/bar' with '/baz/qux' in the input text using a sed command that avoids delimiter conflicts with forward slashes.
sed 's,/foo/bar,/baz/qux,g'
The path is /foo/bar and it leads to /foo/bar/home.
The path is /baz/qux and it leads to /baz/qux/home.
Go to /foo/bar now.
Go to /baz/qux now.
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/5864146/using-different-delimiters-in-sed-commands-and-range-addresses
Using different delimiters in sed commands and range addresses
DerZauberer
geekosaur
5,864,155
75
true
null
null
null
null
so-5864146-p1
Replace all instances of '/foo/bar' with '/baz/qux' using a sed command that employs an alternative delimiter to avoid conflicts with forward slashes.
sed 's,/foo/bar,/baz/qux,g'
The path is /foo/bar and it leads to /foo/bar/home.
The path is /baz/qux and it leads to /baz/qux/home.
Go to /foo/bar now.
Go to /baz/qux now.
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/5864146/using-different-delimiters-in-sed-commands-and-range-addresses
Using different delimiters in sed commands and range addresses
DerZauberer
geekosaur
5,864,155
75
true
so-5864146
qwen/qwen3.7-plus
null
null
so-6111679
Insert a newline before every occurrence of the string '1234' in the input text.
sed 's/1234/\n&/g'
test1234foo123bar1234
test 1234foo123bar 1234
abc1234xyz 1234start
abc 1234xyz 1234start
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/6111679/insert-linefeed-in-sed-mac-os-x
Insert linefeed in sed (Mac OS X)
Tyilo
przemoc
6,112,270
47
true
null
null
null
null
so-6111679-p1
Prepend a newline character to every instance of '1234' found in the text.
sed 's/1234/\n&/g'
test1234foo123bar1234
test 1234foo123bar 1234
abc1234xyz 1234start
abc 1234xyz 1234start
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/6111679/insert-linefeed-in-sed-mac-os-x
Insert linefeed in sed (Mac OS X)
Tyilo
przemoc
6,112,270
47
true
so-6111679
qwen/qwen3.7-plus
null
null
so-6156259
Print lines that contain the substring 'teste', optionally preceded by 'www.'. Use POSIX Basic Regular Expressions only.
sed -n '/\(www\.\)\{0,1\}teste/p'
http://www.tested.com/ http://tested.com/ http://www.teased.com/
http://www.tested.com/ http://tested.com/
www.teste no match here teste at start
www.teste teste at start
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/6156259/sed-expression-doesnt-allow-optional-grouped-string
Sed expression doesn't allow optional grouped string
Eduardo
Jonathan Leffler
6,157,705
77
true
null
null
null
null
so-6156259-p1
Output lines matching the substring 'teste', which may be optionally prefixed by 'www.', utilizing only POSIX Basic Regular Expressions.
sed -n '/\(www\.\)\{0,1\}teste/p'
http://www.tested.com/ http://tested.com/ http://www.teased.com/
http://www.tested.com/ http://tested.com/
www.teste no match here teste at start
www.teste teste at start
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/6156259/sed-expression-doesnt-allow-optional-grouped-string
Sed expression doesn't allow optional grouped string
Eduardo
Jonathan Leffler
6,157,705
77
true
so-6156259
qwen/qwen3.7-plus
null
null
so-6554066
Enclose every line of the input text in double quotes.
sed 's/\(.*\)/"\1"/'
hello world foo bar baz
"hello world" "foo bar" "baz"
line one line two
"line one" "line two"
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/6554066/how-to-enclose-every-line-in-a-file-in-double-quotes-with-sed
How to enclose every line in a file in double quotes with sed?
nw.
Karoly Horvath
6,554,082
34
true
null
null
null
null
so-6554066-p1
Wrap each line of the input with double quotes.
sed 's/\(.*\)/"\1"/'
hello world foo bar baz
"hello world" "foo bar" "baz"
line one line two
"line one" "line two"
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/6554066/how-to-enclose-every-line-in-a-file-in-double-quotes-with-sed
How to enclose every line in a file in double quotes with sed?
nw.
Karoly Horvath
6,554,082
34
true
so-6554066
qwen/qwen3.7-plus
null
null
so-6739258
Insert the line 'nameserver 127.0.0.1' immediately before the first line that starts with 'nameserver'.
sed '1,/^nameserver/ { /^nameserver/i\ nameserver 127.0.0.1 }'
# Generated by NetworkManager domain dhcp.example.com search dhcp.example.com nameserver 10.0.0.1 nameserver 10.0.0.2 nameserver 10.0.0.3
# Generated by NetworkManager domain dhcp.example.com search dhcp.example.com nameserver 127.0.0.1 nameserver 10.0.0.1 nameserver 10.0.0.2 nameserver 10.0.0.3
domain example.com nameserver 8.8.8.8
domain example.com nameserver 127.0.0.1 nameserver 8.8.8.8
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/6739258/how-do-i-add-a-line-of-text-to-the-middle-of-a-file-using-bash
How do I add a line of text to the middle of a file using bash?
PHLAK
brandizzi
6,739,322
57
true
null
null
null
null
so-6739258-p1
Insert the line 'nameserver 127.0.0.1' directly above the first line beginning with 'nameserver'.
sed '1,/^nameserver/ { /^nameserver/i\ nameserver 127.0.0.1 }'
# Generated by NetworkManager domain dhcp.example.com search dhcp.example.com nameserver 10.0.0.1 nameserver 10.0.0.2 nameserver 10.0.0.3
# Generated by NetworkManager domain dhcp.example.com search dhcp.example.com nameserver 127.0.0.1 nameserver 10.0.0.1 nameserver 10.0.0.2 nameserver 10.0.0.3
domain example.com nameserver 8.8.8.8
domain example.com nameserver 127.0.0.1 nameserver 8.8.8.8
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/6739258/how-do-i-add-a-line-of-text-to-the-middle-of-a-file-using-bash
How do I add a line of text to the middle of a file using bash?
PHLAK
brandizzi
6,739,322
57
true
so-6739258
qwen/qwen3.7-plus
null
null
so-6852951
Replace all backslashes with forward slashes in the input text.
sed 's/\\/\//g'
C:\Windows\Folder\File.txt
C:/Windows/Folder/File.txt
path\to\file another\path
path/to/file another/path
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/6852951/use-sed-to-replace-all-backslashes-with-forward-slashes
Use sed to replace all backslashes with forward slashes
Emily
Emiliano Poggi
6,853,005
63
true
null
null
null
null
so-6852951-p1
Substitute every backslash in the text with a forward slash.
sed 's/\\/\//g'
C:\Windows\Folder\File.txt
C:/Windows/Folder/File.txt
path\to\file another\path
path/to/file another/path
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/6852951/use-sed-to-replace-all-backslashes-with-forward-slashes
Use sed to replace all backslashes with forward slashes
Emily
Emiliano Poggi
6,853,005
63
true
so-6852951
qwen/qwen3.7-plus
null
null
so-6945621
Remove all lines from the start marker '<!-- BOF CLEAN -->' to the end marker '<!-- EOF CLEAN -->' inclusive.
sed '/<!-- BOF CLEAN -->/,/<!-- EOF CLEAN -->/d'
abc <!-- BOF CLEAN --> ... a bunch of stuff <!-- EOF CLEAN --> def
abc def
keep this <!-- BOF CLEAN --> delete this <!-- EOF CLEAN --> keep this too
keep this keep this too
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/6945621/using-sed-to-remove-a-block-of-text
Using sed to remove a block of text
Scott C Wilson
Maxim Egorushkin
6,945,788
41
true
null
null
null
null
so-6945621-p1
Delete all lines ranging from the start marker '<!-- BOF CLEAN -->' to the end marker '<!-- EOF CLEAN -->', including the markers themselves.
sed '/<!-- BOF CLEAN -->/,/<!-- EOF CLEAN -->/d'
abc <!-- BOF CLEAN --> ... a bunch of stuff <!-- EOF CLEAN --> def
abc def
keep this <!-- BOF CLEAN --> delete this <!-- EOF CLEAN --> keep this too
keep this keep this too
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/6945621/using-sed-to-remove-a-block-of-text
Using sed to remove a block of text
Scott C Wilson
Maxim Egorushkin
6,945,788
41
true
so-6945621
qwen/qwen3.7-plus
null
null
so-7103863
Print only the second line of the input text.
sed -n '2p'
@SRR005108.1 :3:1:643:216 GATTTCTGGCCCGCCGCTCGATAATACAGTAATTCC + IIIIII/III*IIIIIIIIII+IIIII;IIAIII%>
GATTTCTGGCCCGCCGCTCGATAATACAGTAATTCC
line1 line2 line3
line2
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/7103863/how-to-get-only-second-line-with-sed
How to get ONLY Second line with SED
neversaint
Jonathan
7,103,911
41
true
null
null
null
null
so-7103863-p1
Display exclusively the second line from the input.
sed -n '2p'
@SRR005108.1 :3:1:643:216 GATTTCTGGCCCGCCGCTCGATAATACAGTAATTCC + IIIIII/III*IIIIIIIIII+IIIII;IIAIII%>
GATTTCTGGCCCGCCGCTCGATAATACAGTAATTCC
line1 line2 line3
line2
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/7103863/how-to-get-only-second-line-with-sed
How to get ONLY Second line with SED
neversaint
Jonathan
7,103,911
41
true
so-7103863
qwen/qwen3.7-plus
null
null
so-7359527
Remove all leading empty lines from the input stream.
sed '/./,$!d'
first line second line
first line second line
start here middle blank
start here middle blank
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/7359527/removing-trailing-starting-newlines-with-sed-awk-tr-and-friends
Removing trailing / starting newlines with sed, awk, tr, and friends
ELLIOTTCABLE
dogbane
7,359,879
56
true
null
null
null
null
so-7359527-p1
Strip all initial blank lines from the input stream.
sed '/./,$!d'
first line second line
first line second line
start here middle blank
start here middle blank
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/7359527/removing-trailing-starting-newlines-with-sed-awk-tr-and-friends
Removing trailing / starting newlines with sed, awk, tr, and friends
ELLIOTTCABLE
dogbane
7,359,879
56
true
so-7359527
qwen/qwen3.7-plus
null
null
so-7635807
Remove all double quote characters from the input text.
sed 's/"//g'
He said "hello" to her. She replied "hi" back.
He said hello to her. She replied hi back.
No "quotes" here. Just text.
No quotes here. Just text.
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/7635807/how-to-use-sed-to-remove-all-double-quotes-within-a-file
How to use sed to remove all double quotes within a file
MRTim2day
user104863
7,635,852
63
true
null
null
null
null
so-7635807-p1
Delete every double quote character from the text.
sed 's/"//g'
He said "hello" to her. She replied "hi" back.
He said hello to her. She replied hi back.
No "quotes" here. Just text.
No quotes here. Just text.
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/7635807/how-to-use-sed-to-remove-all-double-quotes-within-a-file
How to use sed to remove all double quotes within a file
MRTim2day
user104863
7,635,852
63
true
so-7635807
qwen/qwen3.7-plus
null
null
so-7657647
Remove all occurrences of the strings 'File' and 'MINvac.pdb' from each line of the input text.
sed 's/File//g;s/MINvac\.pdb//g'
-6174.27 File10MINvac.pdb -514.451 File11MINvac.pdb
-6174.27 10 -514.451 11
4065.68 File12MINvac.pdb -4708.64 File13MINvac.pdb
4065.68 12 -4708.64 13
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/7657647/combining-two-sed-commands
Combining two sed commands
kanika
tripleee
7,657,662
81
true
null
null
null
null
so-7657647-p1
Strip the strings 'File' and 'MINvac.pdb' from every line in the input.
sed 's/File//g;s/MINvac\.pdb//g'
-6174.27 File10MINvac.pdb -514.451 File11MINvac.pdb
-6174.27 10 -514.451 11
4065.68 File12MINvac.pdb -4708.64 File13MINvac.pdb
4065.68 12 -4708.64 13
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/7657647/combining-two-sed-commands
Combining two sed commands
kanika
tripleee
7,657,662
81
true
so-7657647
qwen/qwen3.7-plus
null
null
so-7680504
Replace all occurrences of the literal text 'draw(1;n_)' with 'draw(2;n_)' in the input stream.
sed 's/draw(1;n_)/draw(2;n_)/g'
call draw(1;n_) here and draw(1;n_) there
call draw(2;n_) here and draw(2;n_) there
draw(1;n_) only
draw(2;n_) only
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/7680504/sed-substitution-with-bash-variables
sed substitution with Bash variables
csta
k.parnell
7,680,548
90
true
null
null
null
null
so-7680504-p1
Substitute every instance of the literal string 'draw(1;n_)' with 'draw(2;n_)' throughout the input.
sed 's/draw(1;n_)/draw(2;n_)/g'
call draw(1;n_) here and draw(1;n_) there
call draw(2;n_) here and draw(2;n_) there
draw(1;n_) only
draw(2;n_) only
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/7680504/sed-substitution-with-bash-variables
sed substitution with Bash variables
csta
k.parnell
7,680,548
90
true
so-7680504
qwen/qwen3.7-plus
null
null
so-7814205
Remove the first word from each line of the input text.
sed 's/^[^ ]* //'
some text 1 some text 2 some text 3
text 1 text 2 text 3
hello world foo bar baz
world bar baz
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/7814205/remove-the-first-word-in-a-text-stream
Remove the first word in a text stream
Trcx
Kent
7,814,456
44
true
null
null
null
null
so-7814205-p1
Delete the first word from every line of the input.
sed 's/^[^ ]* //'
some text 1 some text 2 some text 3
text 1 text 2 text 3
hello world foo bar baz
world bar baz
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/7814205/remove-the-first-word-in-a-text-stream
Remove the first word in a text stream
Trcx
Kent
7,814,456
44
true
so-7814205
qwen/qwen3.7-plus
null
null
so-7852132
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.
sed ':a;/0$/{N;s/\n//;ba}'
412|n|Leader Building Material||||||||||d|d|20||0 107|n|Knot Tying Tools|||||Knot Tying Tools |||||d|d|0||0 Another line Ends with 0 Next part
412|n|Leader Building Material||||||||||d|d|20||0107|n|Knot Tying Tools|||||Knot Tying Tools |||||d|d|0||0Another line Ends with 0Next part
Line ending in 0 continuation Normal line Zero at end0 more data
Line ending in 0continuation Normal line Zero at end0more data
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/7852132/sed-join-lines-together
sed join lines together
veilig
ninjalj
7,853,846
37
true
null
null
null
null
so-7852132-p1
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.
sed ':a;/0$/{N;s/\n//;ba}'
412|n|Leader Building Material||||||||||d|d|20||0 107|n|Knot Tying Tools|||||Knot Tying Tools |||||d|d|0||0 Another line Ends with 0 Next part
412|n|Leader Building Material||||||||||d|d|20||0107|n|Knot Tying Tools|||||Knot Tying Tools |||||d|d|0||0Another line Ends with 0Next part
Line ending in 0 continuation Normal line Zero at end0 more data
Line ending in 0continuation Normal line Zero at end0more data
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/7852132/sed-join-lines-together
sed join lines together
veilig
ninjalj
7,853,846
37
true
so-7852132
qwen/qwen3.7-plus
null
null
so-8008546
Remove all double quote characters from the input text.
sed 's/"//g'
EngineVersion="5.2.5.624" Name="Test"
EngineVersion=5.2.5.624 Name=Test
"hello" world no quotes here
hello world no quotes here
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/8008546/remove-a-specific-character-using-awk-or-sed
Remove a specific character using awk or sed
AabinGunz
Piotr Praszmo
8,008,729
50
true
null
null
null
null
so-8008546-p1
Strip all double quote characters from the provided text.
sed 's/"//g'
EngineVersion="5.2.5.624" Name="Test"
EngineVersion=5.2.5.624 Name=Test
"hello" world no quotes here
hello world no quotes here
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/8008546/remove-a-specific-character-using-awk-or-sed
Remove a specific character using awk or sed
AabinGunz
Piotr Praszmo
8,008,729
50
true
so-8008546
qwen/qwen3.7-plus
null
null
so-8857705
Delete the first two lines of the input text.
sed '1,2d'
blah blahsdfsj 1 2 3 4
1 2 3 4
header1 header2 data1 data2
data1 data2
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/8857705/deleting-the-first-two-lines-of-a-file-using-bash-or-awk-or-sed-or-whatever
Deleting the first two lines of a file using BASH or awk or sed or whatever
Amit
RobS
8,857,734
41
true
null
null
null
null
so-8857705-p1
Discard the first two lines of the input.
sed '1,2d'
blah blahsdfsj 1 2 3 4
1 2 3 4
header1 header2 data1 data2
data1 data2
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/8857705/deleting-the-first-two-lines-of-a-file-using-bash-or-awk-or-sed-or-whatever
Deleting the first two lines of a file using BASH or awk or sed or whatever
Amit
RobS
8,857,734
41
true
so-8857705
qwen/qwen3.7-plus
null
null
so-9053100
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.
sed '/BEGIN_FOO_END/b; s/BEGIN_\(.*\)_END/(\1)/g'
BEGIN_bar_END BEGIN_buz_END BEGIN_FOO_END BEGIN_ihfd8f398IHFf9f39_END
(bar) (buz) BEGIN_FOO_END (ihfd8f398IHFf9f39)
test_BEGIN_x_END BEGIN_FOO_END BEGIN_y_END
test_(x) BEGIN_FOO_END (y)
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/9053100/sed-regex-and-substring-negation
Sed regex and substring negation
Anthony
Fred Foo
9,053,163
52
true
null
null
null
null
so-9053100-p1
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.
sed '/BEGIN_FOO_END/b; s/BEGIN_\(.*\)_END/(\1)/g'
BEGIN_bar_END BEGIN_buz_END BEGIN_FOO_END BEGIN_ihfd8f398IHFf9f39_END
(bar) (buz) BEGIN_FOO_END (ihfd8f398IHFf9f39)
test_BEGIN_x_END BEGIN_FOO_END BEGIN_y_END
test_(x) BEGIN_FOO_END (y)
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/9053100/sed-regex-and-substring-negation
Sed regex and substring negation
Anthony
Fred Foo
9,053,163
52
true
so-9053100
qwen/qwen3.7-plus
null
null
so-9189120
Replace the substring 'string-' followed by any single character with 'string-0' in each line.
sed 's/string-./string-0/g'
some-string-8 other-string-X no-match-here
some-string-0 other-string-0 no-match-here
test-string-5 string-a-end
test-string-0 string-0-end
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/9189120/using-sed-with-wildcard
Using SED with wildcard
mahmood
tom
9,189,153
57
true
null
null
null
null
so-9189120-p1
In every line, substitute any instance of 'string-' followed by a single character with 'string-0'.
sed 's/string-./string-0/g'
some-string-8 other-string-X no-match-here
some-string-0 other-string-0 no-match-here
test-string-5 string-a-end
test-string-0 string-0-end
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/9189120/using-sed-with-wildcard
Using SED with wildcard
mahmood
tom
9,189,153
57
true
so-9189120
qwen/qwen3.7-plus
null
null
so-9205669
Replace all occurrences of the literal string {test1} with test2 in the input text.
sed 's/{test1}/test2/g'
This is a test {test1} line. Another {test1} occurrence here. No match here. End of {test1} file.
This is a test test2 line. Another test2 occurrence here. No match here. End of test2 file.
Start {test1} middle {test1} end. Single {test1} line.
Start test2 middle test2 end. Single test2 line.
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/9205669/sed-find-and-replace-with-curly-braces
sed find and replace with curly braces
atdev
kev
9,205,806
39
true
null
null
null
null
so-9205669-p1
Replace every occurrence of the literal string {test1} with test2 throughout the input.
sed 's/{test1}/test2/g'
This is a test {test1} line. Another {test1} occurrence here. No match here. End of {test1} file.
This is a test test2 line. Another test2 occurrence here. No match here. End of test2 file.
Start {test1} middle {test1} end. Single {test1} line.
Start test2 middle test2 end. Single test2 line.
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/9205669/sed-find-and-replace-with-curly-braces
sed find and replace with curly braces
atdev
kev
9,205,806
39
true
so-9205669
qwen/qwen3.7-plus
null
null
so-9591744
Append ' anotherthing' to the end of any line that starts with 'all:'.
sed '/^all:/ s/$/ anotherthing/'
somestuff... all: thing otherthing some other stuff
somestuff... all: thing otherthing anotherthing some other stuff
all: foo bar: baz
all: foo anotherthing bar: baz
real-stackoverflow
3
train
stackoverflow-accepted-answer
CC-BY-SA-4.0
https://stackoverflow.com/questions/9591744/how-to-add-to-the-end-of-lines-containing-a-pattern-with-sed-or-awk
How to add to the end of lines containing a pattern with sed or awk?
yasar
user219882
9,591,835
98
true
null
null
null
null
so-9591744-p1
Add ' anotherthing' to the end of any line that begins with 'all:'.
sed '/^all:/ s/$/ anotherthing/'
somestuff... all: thing otherthing some other stuff
somestuff... all: thing otherthing anotherthing some other stuff
all: foo bar: baz
all: foo anotherthing bar: baz
real-stackoverflow
3
train
openrouter-paraphrase
CC-BY-SA-4.0
https://stackoverflow.com/questions/9591744/how-to-add-to-the-end-of-lines-containing-a-pattern-with-sed-or-awk
How to add to the end of lines containing a pattern with sed or awk?
yasar
user219882
9,591,835
98
true
so-9591744
qwen/qwen3.7-plus
null
null