10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
What i'm trying to do here is show X amount of lines before and after the string "serialNumber" is found.
BEFORE=3
AFTER=2
gawk '{a=$0} {count=0} /serialNumber/ && /./ {for(i=NR-'"${BEFORE}"';i<=NR;i++){count++ ;print a}for(i=1;i<'"${AFTER}"';i++){getline; print ; count ++; print... (5 Replies)
Discussion started by: SkySmart
5 Replies
2. Shell Programming and Scripting
I need to check if 2 values exists in the file and if they are equal print 0.
output.txt:
------------
1 2 3 4 5 6
Inputs:
a=1
b=2
My pattern matching code works but I am trying to set a counter if both the pattern matches which does not work.If the count > 0,then I want to... (3 Replies)
Discussion started by: kannan13
3 Replies
3. Shell Programming and Scripting
Hi,
I'm getting stuck when supplying multiple patterns for the below code:
awk -F, '
..
..
if ($0 ~ pattern)
{ .. .. }
..
..
' pattern='$ROW' input_file
for the same code I'm trying to supply multiple patterns as given below:
awk -F, '
..
..
if( ($0 ~ pattern) && ($0 ~... (6 Replies)
Discussion started by: penqueen
6 Replies
4. Shell Programming and Scripting
Hello Experts
I have a requirement wherein I need to fetch multiple data from huge dump
egrep -f Pattern.txt Dump.txt
My pattern file has got like 300 entries and Dump file is like 8GB data.
It taking eternity to complete on my machine.
Is their a faster way to search pattern like using... (5 Replies)
Discussion started by: navkanwal
5 Replies
5. Shell Programming and Scripting
Hi,
I want to grep multiple patterns from multiple files and save to multiple outputs. As of now its outputting all to the same file when I use this command.
Input : 108 files to check for 390 patterns to check for. output I need to 108 files with the searched patterns.
Xargs -I {} grep... (3 Replies)
Discussion started by: Diya123
3 Replies
6. Shell Programming and Scripting
Hello,
I have the following input file:
qh1adm 20130710111201 : tp import all QH1 u6 -Dsourcesystems=BFI,EBJ
qh1adm 20130711151154 : tp import all QH1 u6 -Dsourcesystems=BFI,EBJ
qx1adm 20130711151154 : tp count QX1 u6 -Dsourcesystems=B17,E17,EE7
qh1adm 20130711151155 : tp import all... (7 Replies)
Discussion started by: kcboy
7 Replies
7. Shell Programming and Scripting
Hi,
I am using sub to remove blank spaces and one pattern(=>) from the input string. It works fine when I am using two sub functions for the same. However it is giving error while I am trying to remove both spaces and pattern using one single sub function.
Working:
$ echo " OK => " |awk... (2 Replies)
Discussion started by: sai_2507
2 Replies
8. Shell Programming and Scripting
Hi,
I have a file with a '|' pipe delimeter. I want to find number of counts for a particular pattern in particular field. Is it possible to do it in a single command?
1) want to find total number of "0" in field 4.
2) want to find total number of different records in field 4 ( similar to... (5 Replies)
Discussion started by: rudoraj
5 Replies
9. Shell Programming and Scripting
Hi,
Im doing a script to find the number of lines included inside a file newly. These lines are in between #ifdef FLAG1 and #else or #endif or #else and #endif.
I tried like this,
awk '/#ifdef Flag1/,/#e/{print}' aa.c | wc -l
awk '/#ifndef Flag1/,/#endif/{print}' aa.c | awk... (6 Replies)
Discussion started by: priyadarshini
6 Replies
10. UNIX for Dummies Questions & Answers
Hi there,
We have been given a bit of coursework using awk on html pages. Without giving too much away and risking the wrath of the plagerism checks, I can say we need to deal with certain html elements.
There may be several of these elements on one line. My question is, if there are more... (1 Reply)
Discussion started by: Plavixo
1 Replies