Jump to content

Annallu Akkallu Unix question ravali


Kumaravaarma

Recommended Posts

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
 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 .)
Link to comment
Share on other sites

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.  

Link to comment
Share on other sites

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) 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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}👍👍

Link to comment
Share on other sites

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
 

 

 
thumbnail.jpg?domain=www.electroappsmacs.com
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

 

Link to comment
Share on other sites

6 hours ago, WigsandThighs said:

$ rm [options] {file-name}👍👍

rm -f filename . endukavvayya opt vallu chuste vadu nijaganee try chestadu prod lo

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...