![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pls help me in scripting | lakshmananindia | UNIX for Advanced & Expert Users | 3 | 09-04-2007 08:42 PM |
| difference between AIX shell scripting and Unix shell scripting. | haroonec | Shell Programming and Scripting | 2 | 04-12-2006 08:12 AM |
| scripting guru's pls help me with scripting on AIX | thatiprashant | Shell Programming and Scripting | 1 | 01-20-2006 07:58 PM |
| New to scripting | sdrtaz | Shell Programming and Scripting | 2 | 03-18-2005 03:22 AM |
| HELP! Need HELP scripting! | adawg1283 | Shell Programming and Scripting | 7 | 09-29-2004 03:48 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Scripting via awk
Hi,
I am trying to understand what is happening here, new to scripting: I have a couple of these, but if I knew what was going on in one I can figure out the rest: Code:
awk '/rpc-100083/ { $2 = "enable -r" }
$3 ~ /.NOS99dtlogin/ { $t = $2; $2 = $3; $3 = $t }
{ print }' /var/svc/profile/upgrade \
>/var/svc/profile/upgrade.new
mv /var/svc/profile/upgrade.new /var/svc/profile/upgrade
Thanks. Last edited by vgersh99; 04-21-2009 at 11:13 AM.. |
|
|||||
|
Firstly, please use the BB code tags when posting code/data samples.
Code:
awk '
# if there's a "rpc-100083" pattern found anywhere on a current line, assign a
# second field ($2) a string "enable -r"
/rpc-100083/ { $2 = "enable -r" }
# if a THRIRD field ($3) contains a pattern ".NOS99dtlogin", then swap the
# values in the SEND and the THIRD fields. Most likely you meant "t" and
# not "$t" variable as a temp place holder.
$3 ~ /.NOS99dtlogin/ { t = $2; $2 = $3; $3 = t }
# print the current record/line
{ print }' /var/svc/profile/upgrade \
>/var/svc/profile/upgrade.new
# Above: output the result to "upgrade.new" file
# move "upgrade.new" to "upgrade"
mv /var/svc/profile/upgrade.new /var/svc/profile/upgrade
|
|
||||
|
Noted.
Ok, Basically , what is being achieved here, e.g how would this help in placing security measures on Solaris? |
| Sponsored Links | ||
|
|