12-13-2010
Every awk program consists of a 1 or more blocks of
LOGICAL-EXPRESSION { ACTIONS }
If LOGICAL-EXPRESSION is evaluated for each input line and if it equates to true (or it wasn't specified) the ACTIONS block is executed for that line.
(Special LEs of BEGIN (and END) execute their ACTION block once before (or after) the file is processed, this program dosn't use BEGIN or END)
If ACTIONS block is missing the default action is applied, which is print the current line buffer.
In this program we have 1 action block without a LE (so it executes for every line) and after that we have an LE of 1 (true) with no ACTION so it prints every line buffer. We modify the value of field 1 in the 1st action block and this printe in the 2nd.
Breakdown of code as follows:
Code | Description |
-F, | Field seperator as comma |
$1= | Replace value of first field with... |
NR>1?X:Y | if record # greater than 1 then X else Y |
"amr,"$1",dummy,10" | X: arm, + 1st field + ,dummy,10 |
"region,"$1",key,value" | Y: region, + 1st field + ,key,value |
1 | 1 is true, default action is print record (with updated 1st field), using OFS specified below |
OFS=, | Output field sepeartor is comma |
Last edited by Chubler_XL; 12-13-2010 at 10:33 PM..
This User Gave Thanks to Chubler_XL For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to create new directory by increasing the number by 1 of extracted lastly created directory.
e.g.
Log\out_log_1\
Log\out_log_2\
Log\out_log_3\
become
Log\out_log_1\
Log\out_log_2\
Log\out_log_3\
Log\out_log_4\
Can anyone help how to do it in c-shell... (3 Replies)
Discussion started by: Andre_2008
3 Replies
2. Red Hat
hi all,
i have added new LUN to Redhat 5. i have already scanned LUN devices and it is confirmed that Kernel sees the newly added LUN's. i have used /proc/partitions and verified that my disks are there.
However, i cannot find my disk using fdisk -l command. I am not sure what did i... (2 Replies)
Discussion started by: gisu0602
2 Replies
3. Shell Programming and Scripting
I'm somewhat new to BASH scripting but have managed to work my way through most of a problem. I'm trying to get a list of filenames where a column header occurs and any value in that column is within a range.
So far I can sort through the list of files in a directory specified by the user, find... (5 Replies)
Discussion started by: hu_r_u2000
5 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I just forgot what command we can use to open a file, and then see its updates, I remember that there is an option -f ,but with what command :wall:
Tx
Trent (1 Reply)
Discussion started by: trento17
1 Replies
5. Red Hat
Hi Everyone,
I have added new Virtual disk to OS. The main point is I need to bring this whole Disk into LVM control, is it necessary to partition the disk using fdisk command and assign partition type as '8e', or can I directly add that disk into LVM, by running pvcreate command with out... (2 Replies)
Discussion started by: bobby320
2 Replies
6. Shell Programming and Scripting
Possible filenames:
CDD_Whatever.txt
DDD_Whatever.txt
If the file prefix = CDD, I'd like to prefix every person ID (second column in my examples below) on the file with "c-"
If the file prefix = DDD, I'd like to prefix ever person ID with "d-"
Input:
Desired Output:
Any help... (2 Replies)
Discussion started by: lrluis
2 Replies
7. Hardware
Hi ,
I have created one new lun in my SAN storage and make it visible to my HP servers , but the fdisk -l output is somehow confusing. Do not know what to do next ----------
fdisk -l /dev/sdo1
Disk /dev/sdo1 (Sun disk label): 64 heads, 32 sectors, 10238 cylinders
Units =... (7 Replies)
Discussion started by: mishra.sankar
7 Replies
8. UNIX for Advanced & Expert Users
My project is on solaris 10 using cvs 1.12.13. A team member has added a new file to the repo using the add command followed by commit. When another team member executes the status command in the directory containing the new file they do not get notifiction that there is a file that needs to be... (0 Replies)
Discussion started by: twk
0 Replies
9. Red Hat
Hi Folks,
I am unable to detected newly added HDD in my redhat-5 OS.
I am expecting to get /dev/sdb.
Following are the utilized commands or syntax.
root@hostname% cat /etc/redhat-release
Red Hat Enterprise Linux Client release 5.4 (Tikanga) echo "- - -" > /sys/class/scsi_host/host0/scan %... (1 Reply)
Discussion started by: Sricharan21
1 Replies
10. Linux
Hi
I am not familiar with the linux, but I was asked to create a file system on a LUN from the NetApp that was mapped to the linux server.
The server is runing:
uname -a
Linux localhost.localdomain 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:15 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
and now... (6 Replies)
Discussion started by: fretagi
6 Replies
LEARN ABOUT DEBIAN
shorewall6-actions
SHOREWALL6-ACTIONS(5) [FIXME: manual] SHOREWALL6-ACTIONS(5)
NAME
actions - shorewall6 action declaration file
SYNOPSIS
/etc/shorewall6/actions
DESCRIPTION
This file allows you to define new ACTIONS for use in rules (see shorewall6-rules(5)[1]). You define the ip6tables rules to be performed in
an ACTION in /etc/shorewall6/action.action-name.
ACTION names should begin with an upper-case letter to distinguish them from Shorewall-generated chain names and be composed of letters,
digits or numbers. If you intend to log from the action then the name must be no longer than 11 characters in length if you use the
standard LOGFORMAT.
FILES
/etc/shorewall6/actions
SEE ALSO
http://shorewall.net/Actions.html
shorewall6(8), shorewall6-accounting(5), shorewall6-blacklist(5), shorewall6-hosts(5), shorewall6-interfaces(5), shorewall6-maclist(5),
shoewall6-netmap(5),shorewall6-params(5), shorewall6-policy(5), shorewall6-providers(5), shorewall6-rtrules(5), shorewall6-routestopped(5),
shorewall6-rules(5), shorewall6.conf(5), shorewall6-secmarks(5), shorewall6-tcclasses(5), shorewall6-tcdevices(5), shorewall6-tcrules(5),
shorewall6-tos(5), shorewall6-tunnels(5), shorewall-zones(5)
NOTES
1. shorewall6-rules(5)
http://www.shorewall.net/manpages6/shorewall-rules.html
[FIXME: source] 06/28/2012 SHOREWALL6-ACTIONS(5)