You are getting the extra X at the end because you are executing your loop one time more than you have pairs in your string. This is the way I would have coded it:
There isn't any bound checking to see that the word passed in is an even number of characters. You could also make the function accept both starting and ending positions in the word in addition to the word.
In my opinion, it's bad form to reference field values (e.g. $1) in a function. Better to pass in the contents of the field that you wish to operate on.
If you want to use a while loop (more cumbersome), then you'll need to 'look ahead' before looping. Something like this:
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)
I am attempting to write a awk script that reads in a file after awk array elements are assigned and using those elements while reading in the new file. Does this make sense?
/pattern/ {tst=$3}
(( getline < "file" ) > 0 ) {
x=x " "tst
}
When I print tst in the END statement it... (9 Replies)
I was writing a awk function and had a error I was wondering about. It revolves around a Multidimensional array starting with ord
example:
if ( _e == 5 ) {
lmrb=$5 ; lmtb=$6 ; larb=$7 ;
latb=$8
}
... (2 Replies)
I have files that store multiple data points for the same device "vertically" and include multiple devices. It repeats a consistant pattern of lines where for each line:
Column 1 is a common number for the entire file and all devices in that file
Column 2 is a unique device number
Column 3 is... (7 Replies)
Hello,
I am working on solving an NP-Complete problem, so it is very important that operations and data with limited integer-argument ranges be computed using immutable look-up-tables contained entirely in CPU cache. Retrieval of the look-up-table data must never leave the CPU once initially... (6 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
HP rp5450 (L2000)
running HP-UX 11.11B
Using DLT 7000 and DLT 4000 tape drives for nightly full backups
Backup jobs created by SAM
DLT 7000 cron entry is as follows:
00 2 * * 1-6 /usr/sam/lbin/br_backup DLT FULL Y /dev/rmt/0m /var/sam/graphLCAa17036 root Y 1 N > /var/sam/SAM_br_msgs 2>&1... (1 Reply)
logs:
"/home/abc/public_html/index.php"
"/home/abc/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
how to use "cut" or "awk" or "sed" to get the following result:
abc
abc
xyz
xyz
xyz (8 Replies)
Discussion started by: timmywong
8 Replies
LEARN ABOUT REDHAT
rpc.rquotad
RQUOTAD(8) System Manager's Manual RQUOTAD(8)NAME
rpc.rquotad - remote quota server
SYNOPSIS
/usr/sbin/rpc.rquotad [ -FI ] [ -p port ] [ -s | -S ] [ -x path ]
/usr/sbin/rpc.rquotad [ -h | -V ]
DESCRIPTION
rpc.rquotad is an rpc(3) server which returns quotas for a user of a local filesystem which is mounted by a remote machine over the NFS.
It also allows setting of quotas on NFS mounted filesystem (if configured during compilation and allowed by a command line option -S). The
results are used by quota(1) to display user quotas for remote filesystems and by edquota(8) to set quotas on remote filesystems. rquotad
daemon uses tcp-wrappers library (under service name rquotad) which allows you to specify hosts allowed/disallowed to use the daemon (see
hosts.allow(5) manpage for more information). The rquotad daemon is normally started at boot time from the system startup scripts.
OPTIONS -h, --help
Show program usage and exit. -V, --version Show version of quota tools.
-s, --no-setquota
Don't allow setting of quotas (default). This option is available only if utilities were compiled with the rpcsetquota option.
-S, --setquota
Allow setting of quotas. This option is available only if utilities were compiled with the rpcsetquota option.
-F, --foreground
Run daemon in foreground (may be useful for debugging purposes).
-I, --autofs
Do not ignore autofs mountpoints.
-p port, --port port
Listen on alternate port port.
-x path, --xtab path
Set an alternative file with NFSD export table. This file is used to determine pseudoroot of NFSv4 exports. The pseudoroot is then
prepended to each relative path (i.e. a path not beginning by '/') received in a quota RPC request.
FILES
aquota.user or aquota.group
quota file at the filesystem root (version 2 quota, non-XFS filesystems)
quota.user or quota.group
quota file at the filesystem root (version 1 quota, non-XFS filesystems)
/etc/mtab default filesystems
SEE ALSO quota(1), rpc(3), nfs(5), services(5), inetd(8)RQUOTAD(8)