Kumaravaarma Posted April 24, 2020 Report Share Posted April 24, 2020 cat file.txt text_one: please_come answer: coming and notcoming question_to_answer: y text_two: plese_donot_come answer: nocoming question_to_answer: y text_three: please_come_aftersome answer: coming and nocoming and notcoming question_to_answer: y neenu egrep use chesina ravadam ledu. pattern search by text_* , notcoming* and two conditions satisfy kavali. neenu cat > file.txt > egrep 'text_one | answer:' chesthe correct ravadam ledu. Patterns search kavalisindhi red color lo pettina belw output lo I want the below output text_one: please_come answer: coming and notcoming text_three: please_come_aftersome answer: coming and nocoming and notcoming Quote Link to comment Share on other sites More sharing options...
Kumaravaarma Posted April 24, 2020 Author Report Share Posted April 24, 2020 @unix.admin Quote Link to comment Share on other sites More sharing options...
AndhraneedSCS Posted April 24, 2020 Report Share Posted April 24, 2020 question_to_answer line rakudadu anthe na? use cat text | grep -v question_to_answer Quote Link to comment Share on other sites More sharing options...
Kumaravaarma Posted April 24, 2020 Author Report Share Posted April 24, 2020 1 minute ago, AndhraneedSCS said: question_to_answer line rakudadu anthe na? use cat text | grep -v question_to_answer Kadu bhayya. search pattern that starts with text_* and notcoming* kavali among all 9 lines lo. Quote Link to comment Share on other sites More sharing options...
Kumaravaarma Posted April 24, 2020 Author Report Share Posted April 24, 2020 what does -v do Quote Link to comment Share on other sites More sharing options...
AndhraneedSCS Posted April 24, 2020 Report Share Posted April 24, 2020 4 minutes ago, Kumaravaarma said: what does -v do Excludes the pattern in result set -v, --invert-match Invert the sense of matching, to select non-matching lines. (-v is specified by POSIX .) Quote Link to comment Share on other sites More sharing options...
Kumaravaarma Posted April 24, 2020 Author Report Share Posted April 24, 2020 4 minutes ago, AndhraneedSCS said: Excludes the pattern in result set -v, --invert-match Invert the sense of matching, to select non-matching lines. (-v is specified by POSIX .) Thanks bhayya for -v option . What if I have 10,000 lines and -v doesn't work not a better idea, Do you know another option like -v which can include the exact pattern search ? the pattern search should satisfy all the "AND" condition and exclude the "OR" condition. Quote Link to comment Share on other sites More sharing options...
AndhraneedSCS Posted April 24, 2020 Report Share Posted April 24, 2020 cat file.txt | egrep 'text_|notcoming' Quote Link to comment Share on other sites More sharing options...
AndhraneedSCS Posted April 24, 2020 Report Share Posted April 24, 2020 3 minutes ago, Kumaravaarma said: Thanks bhayya for -v option . What if I have 10,000 lines and -v doesn't work not a better idea, Do you know another option like -v which can include the exact pattern search ? the pattern search should satisfy all the "AND" condition and exclude the "OR" condition. you can grep it 2 times kada. cat file.txt | grep text_ | grep notcoming Is it not working? I did not work on Unix for the last 5 years due to we moving away from it. I used to work on it prior to that (so, some of these may not even work) Quote Link to comment Share on other sites More sharing options...
Kumaravaarma Posted April 24, 2020 Author Report Share Posted April 24, 2020 8 minutes ago, AndhraneedSCS said: cat file.txt | egrep 'text_|notcoming' eedhi neenu munde try chesina ani chepina kada . okasari try chesi chudu it will give like below. cat file.txt | egrep 'text_|notcoming' text_one: please_come answer: coming and notcoming text_two: plese_donot_come ---> I don't need this line to be included. notcoming ledu. text_three: please_come_aftersome answer: coming and nocoming and notcoming I want the below output text_one: please_come answer: coming and notcoming text_three: please_come_aftersome answer: coming and nocoming and notcoming Quote Link to comment Share on other sites More sharing options...
Kumaravaarma Posted April 24, 2020 Author Report Share Posted April 24, 2020 1 minute ago, AndhraneedSCS said: you can grep it 2 times kada. cat file.txt | grep text_ | grep notcoming Is it not working? I did not work on Unix for the last 5 years due to we moving away from it. I used to work on it prior to that (so, some of these may not even work) not working. endukukante first grep text_ tesukavasthadi ..next grep notcoming which is 2 lines of output with notcoming. Quote Link to comment Share on other sites More sharing options...
WigsandThighs Posted April 24, 2020 Report Share Posted April 24, 2020 38 minutes ago, Kumaravaarma said: cat file.txt text_one: please_come answer: coming and notcoming question_to_answer: y text_two: plese_donot_come answer: nocoming question_to_answer: y text_three: please_come_aftersome answer: coming and nocoming and notcoming question_to_answer: y neenu egrep use chesina ravadam ledu. pattern search by text_* , notcoming* and two conditions satisfy kavali. neenu cat > file.txt > egrep 'text_one | answer:' chesthe correct ravadam ledu. Patterns search kavalisindhi red color lo pettina belw output lo I want the below output text_one: please_come answer: coming and notcoming text_three: please_come_aftersome answer: coming and nocoming and notcoming $ rm [options] {file-name}👍👍 Quote Link to comment Share on other sites More sharing options...
kumar4world Posted April 24, 2020 Report Share Posted April 24, 2020 2 hours ago, Kumaravaarma said: cat file.txt text_one: please_come answer: coming and notcoming question_to_answer: y text_two: plese_donot_come answer: nocoming question_to_answer: y text_three: please_come_aftersome answer: coming and nocoming and notcoming question_to_answer: y neenu egrep use chesina ravadam ledu. pattern search by text_* , notcoming* and two conditions satisfy kavali. neenu cat > file.txt > egrep 'text_one | answer:' chesthe correct ravadam ledu. Patterns search kavalisindhi red color lo pettina belw output lo I want the below output text_one: please_come answer: coming and notcoming text_three: please_come_aftersome answer: coming and nocoming and notcoming Flash Player for Mac Stream and View Video, Audio, Multimedia and Rich Internet Applications. www.electroappsmacs.com @Kumaravaarma cat file.txt text_one: please_come answer: coming and notcoming question_to_answer: y text_two: plese_donot_come answer: nocoming question_to_answer: y text_three: please_come_aftersome answer: coming and nocoming and notcoming question_to_answer: y command: cat file.txt | grep -E '^text|notcoming' text_one: please_come answer: coming and notcoming text_two: plese_donot_come text_three: please_come_aftersome answer: coming and nocoming and notcoming Quote Link to comment Share on other sites More sharing options...
Kumaravaarma Posted April 24, 2020 Author Report Share Posted April 24, 2020 6 hours ago, WigsandThighs said: $ rm [options] {file-name}👍👍 rm -f filename . endukavvayya opt vallu chuste vadu nijaganee try chestadu prod lo Quote Link to comment Share on other sites More sharing options...
Kumaravaarma Posted April 24, 2020 Author Report Share Posted April 24, 2020 4 hours ago, kumar4world said: @Kumaravaarma cat file.txt text_one: please_come answer: coming and notcoming question_to_answer: y text_two: plese_donot_come answer: nocoming question_to_answer: y text_three: please_come_aftersome answer: coming and nocoming and notcoming question_to_answer: y command: cat file.txt | grep -E '^text|notcoming' text_one: please_come answer: coming and notcoming text_two: plese_donot_come text_three: please_come_aftersome answer: coming and nocoming and notcoming @kumar4worldBhayya what does -E and caret do ? Naa output ila kavali ante malli malli adhe cheputaru. Text_two line ravaddu. Let me xplain more in details. Consider there are three statements and all the 3 are in one file. I want the output which starts with text_* and matching keyword with no coming. Both condition satisfy avvali. statement#2 key word not coming ledu kadaa anduke statement#2 skip cheyali Statement#1 text_one: please_come answer: coming and notcoming question_to_answer: y Statement#2 text_two: plese_donot_come answer: nocoming question_to_answer: y Statement#3 text_three: please_come_aftersome answer: coming and nocoming and notcoming question_to_answer: y I want the below output text_one: please_come answer: coming and notcoming text_three: please_come_aftersome answer: coming and nocoming and notcoming Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.