Remove entire lines form text file based on URL form 12 colum
Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
I have a file abc.txt in that file having 29 records In these records we need to remove some of the lines which are having the url based on the URL http://163.172.47.140:55555/
For example:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
linux
add a comment |Â
up vote
-1
down vote
favorite
I have a file abc.txt in that file having 29 records In these records we need to remove some of the lines which are having the url based on the URL http://163.172.47.140:55555/
For example:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
linux
Have you tried with a text editor, eg. vi ?
â Gerard H. Pille
Jan 23 at 9:18
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have a file abc.txt in that file having 29 records In these records we need to remove some of the lines which are having the url based on the URL http://163.172.47.140:55555/
For example:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
linux
I have a file abc.txt in that file having 29 records In these records we need to remove some of the lines which are having the url based on the URL http://163.172.47.140:55555/
For example:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
linux
edited Jan 23 at 9:21
andcoz
11.7k32938
11.7k32938
asked Jan 23 at 9:15
Ramadevi Palagani
12
12
Have you tried with a text editor, eg. vi ?
â Gerard H. Pille
Jan 23 at 9:18
add a comment |Â
Have you tried with a text editor, eg. vi ?
â Gerard H. Pille
Jan 23 at 9:18
Have you tried with a text editor, eg. vi ?
â Gerard H. Pille
Jan 23 at 9:18
Have you tried with a text editor, eg. vi ?
â Gerard H. Pille
Jan 23 at 9:18
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
1
down vote
With sed
command:
Sample input.txt
:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://192.172.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
sed -i '/http://163.172.47.140:55555//d' input.txt
-i
- edit file inplaced
- delete records matching a certain pattern
The final input.txt
contents:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://192.172.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
add a comment |Â
up vote
1
down vote
grep -vF 'http://163.172.47.140:55555/' input
-vF str
- all lines that don't contain str
I want to remove the entire line with this 163.172.47.140:55555
â Ramadevi Palagani
Jan 26 at 11:48
add a comment |Â
up vote
1
down vote
Inputfile
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://195.175.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
Below command delete the lines which contains "http://163.172.47.140:55555"
Command:
awk '!/http://163.172.47.140:55555/print $0' inputfile
output
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://195.175.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
cool and readable ... or evenawk '!/http://163.172.47.140:55555/'
â JJoao
Jan 24 at 8:17
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
With sed
command:
Sample input.txt
:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://192.172.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
sed -i '/http://163.172.47.140:55555//d' input.txt
-i
- edit file inplaced
- delete records matching a certain pattern
The final input.txt
contents:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://192.172.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
add a comment |Â
up vote
1
down vote
With sed
command:
Sample input.txt
:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://192.172.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
sed -i '/http://163.172.47.140:55555//d' input.txt
-i
- edit file inplaced
- delete records matching a certain pattern
The final input.txt
contents:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://192.172.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
add a comment |Â
up vote
1
down vote
up vote
1
down vote
With sed
command:
Sample input.txt
:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://192.172.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
sed -i '/http://163.172.47.140:55555//d' input.txt
-i
- edit file inplaced
- delete records matching a certain pattern
The final input.txt
contents:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://192.172.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
With sed
command:
Sample input.txt
:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://192.172.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
sed -i '/http://163.172.47.140:55555//d' input.txt
-i
- edit file inplaced
- delete records matching a certain pattern
The final input.txt
contents:
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://192.172.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
answered Jan 23 at 9:29
RomanPerekhrest
22.4k12144
22.4k12144
add a comment |Â
add a comment |Â
up vote
1
down vote
grep -vF 'http://163.172.47.140:55555/' input
-vF str
- all lines that don't contain str
I want to remove the entire line with this 163.172.47.140:55555
â Ramadevi Palagani
Jan 26 at 11:48
add a comment |Â
up vote
1
down vote
grep -vF 'http://163.172.47.140:55555/' input
-vF str
- all lines that don't contain str
I want to remove the entire line with this 163.172.47.140:55555
â Ramadevi Palagani
Jan 26 at 11:48
add a comment |Â
up vote
1
down vote
up vote
1
down vote
grep -vF 'http://163.172.47.140:55555/' input
-vF str
- all lines that don't contain str
grep -vF 'http://163.172.47.140:55555/' input
-vF str
- all lines that don't contain str
answered Jan 23 at 11:03
JJoao
6,7211826
6,7211826
I want to remove the entire line with this 163.172.47.140:55555
â Ramadevi Palagani
Jan 26 at 11:48
add a comment |Â
I want to remove the entire line with this 163.172.47.140:55555
â Ramadevi Palagani
Jan 26 at 11:48
I want to remove the entire line with this 163.172.47.140:55555
â Ramadevi Palagani
Jan 26 at 11:48
I want to remove the entire line with this 163.172.47.140:55555
â Ramadevi Palagani
Jan 26 at 11:48
add a comment |Â
up vote
1
down vote
Inputfile
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://195.175.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
Below command delete the lines which contains "http://163.172.47.140:55555"
Command:
awk '!/http://163.172.47.140:55555/print $0' inputfile
output
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://195.175.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
cool and readable ... or evenawk '!/http://163.172.47.140:55555/'
â JJoao
Jan 24 at 8:17
add a comment |Â
up vote
1
down vote
Inputfile
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://195.175.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
Below command delete the lines which contains "http://163.172.47.140:55555"
Command:
awk '!/http://163.172.47.140:55555/print $0' inputfile
output
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://195.175.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
cool and readable ... or evenawk '!/http://163.172.47.140:55555/'
â JJoao
Jan 24 at 8:17
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Inputfile
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://195.175.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
Below command delete the lines which contains "http://163.172.47.140:55555"
Command:
awk '!/http://163.172.47.140:55555/print $0' inputfile
output
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://195.175.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
Inputfile
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://195.175.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://163.172.47.140:55555/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
Below command delete the lines which contains "http://163.172.47.140:55555"
Command:
awk '!/http://163.172.47.140:55555/print $0' inputfile
output
- 163.12372.473.1440 35010 2018-01-18 01:03:13 +0000 POST http://195.175.45.130:55550/?oip=163.172.47.140 HTTP/1.1 200 147 -est_useragent - - test_refe test_useragent - - test_referer text/json 323
answered Jan 23 at 14:42
Praveen Kumar BS
1,010128
1,010128
cool and readable ... or evenawk '!/http://163.172.47.140:55555/'
â JJoao
Jan 24 at 8:17
add a comment |Â
cool and readable ... or evenawk '!/http://163.172.47.140:55555/'
â JJoao
Jan 24 at 8:17
cool and readable ... or even
awk '!/http://163.172.47.140:55555/'
â JJoao
Jan 24 at 8:17
cool and readable ... or even
awk '!/http://163.172.47.140:55555/'
â JJoao
Jan 24 at 8:17
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f419036%2fremove-entire-lines-form-text-file-based-on-url-form-12-colum%23new-answer', 'question_page');
);
Post as a guest
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
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
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
Have you tried with a text editor, eg. vi ?
â Gerard H. Pille
Jan 23 at 9:18