Displaying the first field if the second field matches the pattern using Perl
Hi,
I am trying with the below Perl command to print the first field when the second field matches the given pattern:
I know I can achieve the same with the following thread: https://www.unix.com/shell-programmin...s-pattern.html. But still I am curious why this code is not returning any expected result and how to correct it. Any help please.
Hi All,
I would like my code to be able to print out the whole line if 1st field has a dot in the number. Sample input and expected output given below.
My AWK code is below but it can;t work, can any expert help me ?
Thanks in advance.
{if ($1 ~ /*\.*/) { print $0 }}
Input:
... (2 Replies)
Howdy.
I know this is most likely possible using sed or awk or grep, most likely a combination of them together, but how would one go about running a grep like command on a file where you only try to match your pattern to the second field in a line, space delimited?
Example:
You are... (3 Replies)
hi
i have file as below , i want to add duplicate records like bell_bb to one record with valuve as 15 ( addition of both )
any oneline awk script to achive this ?
header 0
CAMPAIGN_NAME 1
Bell_BB 14
Bell_MONTHLY 803
SOLO_UNBEATABLE 644
Bell_BB 1
Bell_MONTHLY 25
SOLO_UNBEATABLE... (4 Replies)
Hi all,
I got several lines line this
a b c d e 1 e
a 1 c d e 3 f
a b c 1 e 8 h
a b c d e 1 w
a 1 c d e 2 w
a b c d e 1 t
a b c d e 7 4
How can I print the line if 1 is the field one before the last field?
Basicly this 2 field ?
a b c d e 1 e
a b c d e 1 t
The file I got is... (7 Replies)
Trying to sum field #6 when field #2 matches string as follows:
Input data:
2010-09-18-20.24.44.206117 UOWEXEC db2bp DB2XYZ hostname 1
2010-09-18-20.24.44.206117 UOWWAIT db2bp DB2XYZ hostname ... (3 Replies)
First, thanks for the help in previous posts... couldn't have gotten where I am now without it!
So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following:
If $1... (4 Replies)
Version: AIX 6.1 (korn shell)
In the below output, the field with the heading 'Address' has some names like
hwproc214-priv1.gnas.wrd.netwhich are only partially displayed.
$ netstat -i
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
en2 1500 link#2 ... (3 Replies)
Within AWK, how do you display a field of NR? Here's my code:
awk '(NR>1) && (P1=$1-w)>=100000 {print "increase of" " " P1*.0000179," " "kW at" " " 'NR*60/431900' " " "minutes" "\n" "change from" " " 'NR-10($1)' " " "kW to" " " 'NR+70($1)' "\n"}{w=$1}' filename
I can change NR and print... (3 Replies)
Hi,
Need to replace last field in a file(/etc/passwd) ,if first filed matches with particular username.
Scenario:
cat testfor1
deekshi:x:7082:7082::/home/deekshi:/bin/bash
harini1:x:7083:7083::/home/harini1:/bin/bash
Here,if first field contains "deekshi", then i should replace... (4 Replies)
Discussion started by: Sumanthsv
4 Replies
LEARN ABOUT REDHAT
mewls
MEWLS(1) General Commands Manual MEWLS(1)NAME
mewls - Message scanner for Mew
SYNOPSIS
mewls [options] [folder [range]]
DESCRIPTION
The mewls utility extracts necessary fields from messages stored in folders. This command is necessary for Mew to implement the asynchro-
nous feature.
The options are as follows:
-a Print all necessary fields when picking.
-b dir Set the Mail home to dir.
-c dir Set the News home to dir.
-d field
Set th field to be extracted to field.
-e command
Specify an external command to fetch mailbox.
-m options
Specify options for command.
-f fields
Specify fields to display.
-h Display this help message.
-i file Set the input stream to file.
-l length
Set the field max length to be extracted to length. The default value is 3. 0 means no limit.
-n Don't use fstat().
-p pattern
Specify the pick pattern.
-s src Set message source to src : '+folder range'.
-w time Set the wait_for timer to timer (microsecond).
-v Display the version.
Definitions of the symbols above are as follows:
range N | [start]-[end] | last:N
pattern 'key=val' | 'key!=val' | '!<pattern>' | '(<pattern>)' | '<pattern>&<pattern>' | '<pattern>|<pattern>'
BUGS
If a field is long, only the beginning three lines are extracted by default.
March 17, 2001 MEWLS(1)