Sponsored Content
Top Forums Shell Programming and Scripting Multiple pattern matching using awk and getting count of lines Post 302625457 by Chubler_XL on Tuesday 17th of April 2012 08:14:26 PM
Old 04-17-2012
Why not change cnt++ to print, it will then output each line that matches and this should help work out what it's matching.

You can also pipe this output to wc -l to confirm the count of matching lines.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

pattern matching over multiple lines and deleting the first

I've got a longish log file with content such as Uplink traffic: Downlink traffic: I want to parse the log file and remove any line that contains the string "Uplink traffic:" at the beginning of the line, but only if the line following it beginnings with the string "Downlink traffic:" (in... (7 Replies)
Discussion started by: Yorkie99
7 Replies

2. Shell Programming and Scripting

sed/awk to insert multiple lines before pattern

I'm attempting to insert multiple lines before a line matching a given search pattern. These lines are generated in a separate function and can either be piped in as stdout or read from a temporary file. I've been able to insert the lines from a file after the pattern using: sed -i '/pattern/... (2 Replies)
Discussion started by: zksailor534
2 Replies

3. Shell Programming and Scripting

Sed/awk/perl command to replace pattern in multiple lines

Hi I know sed and awk has options to give range of line numbers, but I need to replace pattern in specific lines Something like sed -e '1s,14s,26s/pattern/new pattern/' file name Can somebody help me in this.... I am fine with see/awk/perl Thank you in advance (9 Replies)
Discussion started by: dani777
9 Replies

4. Shell Programming and Scripting

Awk: print lines with one of multiple pattern in the same field (column)

Hi all, I am new to using awk and am quickly discovering what a powerful pattern-recognition tool it is. However, I have what seems like a fairly basic task that I just can't figure out how to perform in one line. I want awk to find and print all the lines in which one of multiple patterns (e.g.... (8 Replies)
Discussion started by: elgo4
8 Replies

5. Shell Programming and Scripting

Replacing lines matching a multi-line pattern (sed/perl/awk)

Dear Unix Forums, I am hoping you can help me with a pattern matching problem. What am I trying to do? I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Discussion started by: thefang
10 Replies

6. Shell Programming and Scripting

Sed: printing lines AFTER pattern matching EXCLUDING the line containing the pattern

'Hi I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match. Which option is to be used to exclude the line containing the pattern? sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies

7. Shell Programming and Scripting

awk script issue redirecting to multiple files after matching pattern

Hi All I am having one awk and sed requirement for the below problem. I tried multiple options in my sed or awk and right output is not coming out. Problem Description ############################################################### I am having a big file say file having repeated... (4 Replies)
Discussion started by: kshitij
4 Replies

8. Shell Programming and Scripting

UNIX awk pattern matching and printing lines

I have the below plain text file where i have some result, in order to mail that result in html table format I have written the below script and its working well. cat result.txt Page 2015-01-01 2000 Colors 2015-02-01 3000 Landing 2015-03-02 4000 #!/bin/sh LOG=/tmp/maillog.txt... (1 Reply)
Discussion started by: close2jay
1 Replies

9. Shell Programming and Scripting

awk joining multiple lines based on field count

Hi Folks, I have a file with fields as follows which has last field in multiple lines. I would like to combine a line which has three fields with single field line for as shown in expected output. Please help. INPUT hname01 windows appnamec1eda_p1, ... (5 Replies)
Discussion started by: shunya
5 Replies

10. Shell Programming and Scripting

Group Multiple Lines on SINGLE line matching pattern

Hi Guys, I am trying to format my csv file. When I spool the file using sqlplus the single row output is wrapped on three lines. Somehow I managed to format that file and finally i am trying to make the multiple line on single line. The below command is working fine but I need to pass the... (3 Replies)
Discussion started by: RJSKR28
3 Replies
SYSTEMD-COREDUMPCTL(1)						systemd-coredumpctl					    SYSTEMD-COREDUMPCTL(1)

NAME
systemd-coredumpctl - Retrieve coredumps from the journal SYNOPSIS
systemd-coredumpctl [OPTIONS...] {COMMAND} [PID|COMM|EXE|MATCH...] DESCRIPTION
systemd-coredumpctl may be used to retrieve coredumps from systemd-journald(8). OPTIONS
The following options are understood: -h, --help Print a short help text and exit. --version Print a short version string and exit. -F, --field= Print all possible data values the specified field takes in matching coredump entries of the journal. -o, --output=FILE Write the core to FILE. --no-pager Do not pipe output of list into a pager. --no-legend Do not print the column headers. The following commands are understood: list List coredumps captured in the journal matching specified characteristics. dump Extract the last coredump matching specified characteristics. Coredump will be written on stdout, unless an output file is specified with -o/--output. gdb Invoke the GNU debugger on the last coredump matching specified characteristics. MATCHING
Match can be: PID Process ID of the process that dumped core. An integer. COMM Name of the executable (matches COREDUMP_COMM=). Must not contain slashes. EXE Path to the executable (matches COREDUMP_EXE=). Must contain at least one slash. MATCH General journalctl predicates (see journalctl(1)). Must contain an equals sign. EXIT STATUS
On success, 0 is returned, a non-zero failure code otherwise. Not finding any matching coredumps is treated as failure. SEE ALSO
systemd-journald.service(8), gdb(1) systemd 208 SYSTEMD-COREDUMPCTL(1)
All times are GMT -4. The time now is 11:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy