sed and string of data
up vote
2
down vote
favorite
I need to print the data starting from the line that matches Data after AB process=1234 (full 10):
till end of the file.
I tried putting the data in a variable called "value" and using sed as below. However, it gives an error "extra characters at the end of D command.
value="Data after AB process=1234 (full 10):"
sed -n ' '$value' ' p datasourcefile.log
sed
add a comment |
up vote
2
down vote
favorite
I need to print the data starting from the line that matches Data after AB process=1234 (full 10):
till end of the file.
I tried putting the data in a variable called "value" and using sed as below. However, it gives an error "extra characters at the end of D command.
value="Data after AB process=1234 (full 10):"
sed -n ' '$value' ' p datasourcefile.log
sed
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I need to print the data starting from the line that matches Data after AB process=1234 (full 10):
till end of the file.
I tried putting the data in a variable called "value" and using sed as below. However, it gives an error "extra characters at the end of D command.
value="Data after AB process=1234 (full 10):"
sed -n ' '$value' ' p datasourcefile.log
sed
I need to print the data starting from the line that matches Data after AB process=1234 (full 10):
till end of the file.
I tried putting the data in a variable called "value" and using sed as below. However, it gives an error "extra characters at the end of D command.
value="Data after AB process=1234 (full 10):"
sed -n ' '$value' ' p datasourcefile.log
sed
sed
edited Nov 21 at 21:19
Rui F Ribeiro
38.2k1475125
38.2k1475125
asked Jun 25 '15 at 19:36
alex
6116
6116
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
sed -n '/Data after AB process=1234 (full 10):/,$p' file
or
value='Data after AB process=1234 (full 10):'
sed -n '/'"${value}"'/,$p' file
Take a look at: Difference between single and double quotes in bash
Thank you so much. I tried the second option and it worked
– alex
Jun 25 '15 at 19:54
add a comment |
up vote
0
down vote
{ grep -Fm1 'Data after AB process=1234 (full 10):'; cat; } <infile
...will work w/ a GNU grep
and a regular input file.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
sed -n '/Data after AB process=1234 (full 10):/,$p' file
or
value='Data after AB process=1234 (full 10):'
sed -n '/'"${value}"'/,$p' file
Take a look at: Difference between single and double quotes in bash
Thank you so much. I tried the second option and it worked
– alex
Jun 25 '15 at 19:54
add a comment |
up vote
3
down vote
accepted
sed -n '/Data after AB process=1234 (full 10):/,$p' file
or
value='Data after AB process=1234 (full 10):'
sed -n '/'"${value}"'/,$p' file
Take a look at: Difference between single and double quotes in bash
Thank you so much. I tried the second option and it worked
– alex
Jun 25 '15 at 19:54
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
sed -n '/Data after AB process=1234 (full 10):/,$p' file
or
value='Data after AB process=1234 (full 10):'
sed -n '/'"${value}"'/,$p' file
Take a look at: Difference between single and double quotes in bash
sed -n '/Data after AB process=1234 (full 10):/,$p' file
or
value='Data after AB process=1234 (full 10):'
sed -n '/'"${value}"'/,$p' file
Take a look at: Difference between single and double quotes in bash
edited May 23 '17 at 12:39
Community♦
1
1
answered Jun 25 '15 at 19:42
Cyrus
7,1712835
7,1712835
Thank you so much. I tried the second option and it worked
– alex
Jun 25 '15 at 19:54
add a comment |
Thank you so much. I tried the second option and it worked
– alex
Jun 25 '15 at 19:54
Thank you so much. I tried the second option and it worked
– alex
Jun 25 '15 at 19:54
Thank you so much. I tried the second option and it worked
– alex
Jun 25 '15 at 19:54
add a comment |
up vote
0
down vote
{ grep -Fm1 'Data after AB process=1234 (full 10):'; cat; } <infile
...will work w/ a GNU grep
and a regular input file.
add a comment |
up vote
0
down vote
{ grep -Fm1 'Data after AB process=1234 (full 10):'; cat; } <infile
...will work w/ a GNU grep
and a regular input file.
add a comment |
up vote
0
down vote
up vote
0
down vote
{ grep -Fm1 'Data after AB process=1234 (full 10):'; cat; } <infile
...will work w/ a GNU grep
and a regular input file.
{ grep -Fm1 'Data after AB process=1234 (full 10):'; cat; } <infile
...will work w/ a GNU grep
and a regular input file.
answered Jun 25 '15 at 20:21
mikeserv
45k566152
45k566152
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f212235%2fsed-and-string-of-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown