Handling a special case during tail -f logging [closed] - bash

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am tailing the logs to find if there is any Exception as show below
tail -f flexi.log | grep "Exception" --color
This works fine , but unfortanely i dont want to log it incase if there s any DataNotAvailableException .
The DataNotAvailableException comes frequently and i dont want to log that .
Is this possible ??

Just add another grep to search and remove the DataNotAvailables.
tail -f flexi.log | grep "Exception" --color | grep -v "DataNotAvailableException"

Related

how to cut specific word from a string in BASH [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 months ago.
Improve this question
I have a string in shell script:
string1="0101122100635014,TEST123 22 SEP 06 PQR BC,14,25,0.05,,0915-1530|1815-1915:17,2022-09-30,1665066600,ABC:TEST123629500AB,10,11,90014,TEST123,26009,29500.0,BC"
I want to extract ABC:TEST123629500AB in shell scripting.
echo $string1 | magical command
output: ABC:TEST123629500AB
echo "$string1" | cut -d',' -f10
cut will give you part of string.
-d define the separator.
-f Specifies the column you want based on the separator

Cut all till the end [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have an out put in the below pattern
["snaptuda-shv-22-lla1.example.com","snaptuza-shv-22-lla1.example.com","snaptuservice-proxy-shv-22-lla1.example.com"]
I used below command to strip the domains within the double quotes
cut -d"\"" -f2 file.txt
I got only the first domain , which was
snaptuda-shv-22-lla1.example.com
What I need is all domains till the end of the file , how can I achieve this ?
You input is json. For parsing json there is jq:
jq -r '.[]' filename
Or if the input comes from stdout, like this:
echo '["snaptuda-shv-22-lla1.example.com",...]' | jq -r '.[]'
snaptuda-shv-22-lla1.example.com
snaptuza-shv-22-lla1.example.com
snaptuservice-proxy-shv-22-lla1.example.com

bash shell execution [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am using
sed -s n v
Nothing works for me
The -i flag is only in GNU Sed.
cat file | tr ']' '[' > temp
mv temp file
The above should work for you.

How do I interpret this bash/awk syntax? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am making a sincere effort to master bash.
What would a line like below mean ?
ps -ef | awk '/ora_pmon_/ && !/awk/'
Thank you.
This means as follows.
ps -ef | awk '/ora_pmon_/ && !/awk/'
You are first getting the output of ps -ef which will have information of all processes running. Then by using a <pipe> (|) we send this output to the standard input of the awk command.
awk will check for lines, basically process names, having the string ora_pmon in them AND NOT the string awk. The latter is to exclude the process of this command which we do not want in output.
The correct way to do what you want though is just:
ps -ef | awk '/[o]ra_pmon_/'

Using xargs with qmHandle to remove bounce messages [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have almost 100,000 spam messages in my bounce folder for qmail.
I've been trying to use this command:
find * | xargs -tl `qmHandle -d$1`
But with no success. I've tried multiple variations. I also don't have parallel on my machine.
I did try:
find * | xargs qmHandle -d
But it puts a space between the resulting command of:
qmHandle -d 133893
Found it!
find * | xargs -tl -I {} qmHandle -d{}

Resources