10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" .
I have attached sample input file and the desired input should be as:
INPUT FORMAT:
SELECT
ABCD,
DEFGH,
DFGHJ,
JKLMN,
AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies
2. Shell Programming and Scripting
im using the following code to search a log for entries on two different lines:
awk 'BEGIN{count=0} /'"${firstpattern}"'/,/'"${secondpattern}"'/ { print; if ($0 ~ /'"${thirdpattern}"'/){count++}; } END { print count }' data.txt
firstpattern="start error log"
secondpattern="i am logging the... (1 Reply)
Discussion started by: SkySmart
1 Replies
3. Shell Programming and Scripting
Hi,
I have a file content as below.
Table : PAYR
Displayed fields: 15 of 15 Fixed columns: 4 List width 0999... (4 Replies)
Discussion started by: shirdi
4 Replies
4. Shell Programming and Scripting
Hi
I have below script which is used to grep specific errors and if error string matches send an email alert.
Script is working fine , however , i wish to print next 10 lines of the string match to get the details of error in the email alert
Current code:-
#!/bin/bash
tail -Fn0 --retry... (2 Replies)
Discussion started by: neha0785
2 Replies
5. Shell Programming and Scripting
I want to process a file block by block using sed, and if that block does not contain two patterns, then that complete block has to be printed.
See below for the example data.
................................server 1...............................
running process 1
running... (8 Replies)
Discussion started by: Kesavan
8 Replies
6. Shell Programming and Scripting
I have the following file :
1 2 3 4 5
6 7 8 9 0
9 8 7 6 5
4 3 2 1 0
0 1 2 3 4
Write scripts to
get the following outputs :
A)
1
7
7
1
4 (11 Replies)
Discussion started by: pssooraj72
11 Replies
7. Shell Programming and Scripting
Hi,
I am new to shell scripting and is working on a script to extract lines from a log file between two time stamps using awk command. After some research I used following command:
awk '/01 Oct 2011/{p=1} /10 Oct 2011/{p=0} p' test.log >> tmp.log
This works fine. But now i want to... (3 Replies)
Discussion started by: davidtd
3 Replies
8. Shell Programming and Scripting
Hi,
The below code will search a particular string(say false in this case) and return me 10 lines above and below the search string in a file.
" awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print("***********************************");print;c=a;}b{r=$
0}' b=10 a=10 s="false" "
... (5 Replies)
Discussion started by: vimalm22
5 Replies
9. UNIX for Dummies Questions & Answers
How would I print the word "and" between the words "FOO" and BAR" using sed? My file has three words in it FOO and BAR. I only want the word "and".
Thanks every one. (7 Replies)
Discussion started by: tigta09
7 Replies
10. Shell Programming and Scripting
Hi Gurus,
I have a file say for ex. file1 which has 3500 lines in it which are different account numbers and another file (file2) which has 230000 lines in it. I want to read all the lines in file1 and delete all those lines from file2 which has that same pattern as in file1. I am not quite... (4 Replies)
Discussion started by: toms
4 Replies