Sponsored Content
Top Forums Shell Programming and Scripting awk seach and printing a particular pattern Post 302891148 by sdebasis on Tuesday 4th of March 2014 05:51:47 AM
Old 03-04-2014
Hi Kumar,
You can try the following.


awk '/G/ {print $0}' filename
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Printing out pattern in line

I've scoured the forum and found similar problems but I can't seem to adapt them to help me with my cause. This is a two-part question. I have a multi line file generated by ps | -ef I need to print out a certain type of pattern. The pattern is part static and part dynamic. It is a... (3 Replies)
Discussion started by: FK_Daemon
3 Replies

2. Shell Programming and Scripting

Is it better to grep and pipe to awk, or to seach with awk itself

This may just be a lack of experience talking, but I always assumed that when possible it was better to use a commands built in abilities rather than to pipe to a bunch of commands. I wrote a (very simple) script a while back that was meant to pull out a certain error code, and report back what... (4 Replies)
Discussion started by: DeCoTwc
4 Replies

3. Shell Programming and Scripting

AWK seach for exact word in certain column

Can anyone help me how I will extract all lines in a file where the word "worker" or "co-worker" in 2nd column exist. There are also word in 2nd column like "workers" or "worker2" but I don't want to display those lines. Appreciate any help in advance! Thank you! (5 Replies)
Discussion started by: Orbix
5 Replies

4. Shell Programming and Scripting

NAWK - seach pattern for special characters - } dbl qt - sng qt

i'm puzzled.... trying to look for the pattern }"'. but the below code returns to me the message below (pattern is curley queue + dbl qt + sng qt + period) nawk -v pat="\}\"\'\."' { if (match($0, pat)) { before = substr($0,1,RSTART-1); ... (11 Replies)
Discussion started by: danmauer
11 Replies

5. Shell Programming and Scripting

Printing the continuous occurence of pattern using awk ?

Hello all, I have a input file like this. input file --------------- abc ab001 + ab002 zca acb ab006 + ab007 caz cba ab003 + ab004 zca bac ab004 - ab005 zac bca ab002 - ab003 cza cba ab005 + ab006 acz cba ab005 ... (5 Replies)
Discussion started by: admax
5 Replies

6. Shell Programming and Scripting

Searching and printing the only pattern using awk,sed or perl

Hi All, i have an output of command vmstat as below : $ vmstat System configuration: lcpu=4 mem=5376MB ent=1.00 kthr memory page faults cpu ----- ----------- ------------------------ ------------ ----------------------- r b avm fre re pi... (10 Replies)
Discussion started by: omkar.jadhav
10 Replies

7. 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

8. Shell Programming and Scripting

awk pattern match not printing desired columns

Hi all, I'm trying to match the following two files with the code below: awk -F, 'NR==FNR {a=$0; next} ($12,$4) in a {print $12,$1,a}' OFS="," file4.csv file3.csv but the code does not print the entire row from file4 in addition to column 12 and 1 of file3. file4: o,c,q,co,ov,b... (1 Reply)
Discussion started by: bkane3
1 Replies

9. Shell Programming and Scripting

Help! Printing out CSV output from awk Pattern Match

Hi, I need to search for a word using Awk and print out the line the word is in and every line after the search phrase until I hit this #------------. Then I need to send it to a csv file. So basically the input file format is like this:... (1 Reply)
Discussion started by: An0mander
1 Replies

10. 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
i-ls(1) 						      General Commands Manual							   i-ls(1)

NAME
i-ls - display file stat and checksum information for files SYNOPSIS
i-ls [-s] filename i-ls [-s] dirname Specify a filename for i-ls to examine, or specify a directory with dirname to examine all the files in the directory. -s Do not show/calculate checksums for all regular files. DESCRIPTION
The integrit system detects intrusion by detecting when trusted files have been altered. integrit records information about files in a database. i-ls allows the user to see that information for live files. The output syntax is the same as that of integrit. EXAMPLES
i-ls /tmp/foo.txt shows file stat attributes for the file, "/tmp/foo.txt". i-ls /tmp shows file stat attributes for all files in the directory, "/tmp". i-ls -s /tmp shows file stat attributes for all files in the directory, "/tmp", also including also checksums for all regular files. AUTHOR
Ed L Cashin <ecashin@users.sourceforge.net> See the integrit web site for up to date releases and information at http://integrit.sourceforge.net/ SEE ALSO
Integrit File Verification System Manual (info), lstat(2) Version 4.1 Jul 27, 2001 i-ls(1)
All times are GMT -4. The time now is 01:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy