Because there is at least a single space before and after the second column in the input file. As I said, it is a rather strange example, since using a single space before and after, like you did, is actually more restrictive than using zero or more spaces, since zero spaces would then also match (for example foo$1234.00bar) , so it serves no purpose whatsoever it might as well be left out.. Further it seems puzzling why there should be a strict match for two (or more) decimals. Also the trailing semi-colon after the print statements is unnecessary and the result could also be accomplished in a rather simpler way.
---edit---
Ah, now I see what you mean:
Yes that is different entirely, since that means there should be a singles space before the dot, so that would not match anything,
whereas previously there was asterisk instead of the space:
so that meant zero or more digits ([0-9])...
Last edited by Scrutinizer; 04-04-2014 at 08:44 AM..
so if i introduce space before decimal in my input file then o/p must be change.
below is my change input file. i have added space before decimal.
so, now as per you the o/p of
must match with the O/p of
.
where the input file for this is
mentioned as below
however, o/p is not the same . can you pls explain this behavior.
alsocan you please explain be what is the significanse or working of each astic in below line. for me it is behaving differently.
so if i introduce space before decimal in my input file then o/p must be change.
below is my change input file. i have added space before decimal.
so, now as per you the o/p of
must match with the O/p of
.
Nope. Those are different regexes with different outcomes. The first matches 2 digits before the dot, the second matches one or more digits, in both cases the first digit should be between 1 and 9.
Quote:
where the input file for this is
mentioned as below
however, o/p is not the same . can you pls explain this behavior.
alsocan you please explain be what is the significanse or working of each astic in below line. for me it is behaving differently.
* zero or more spaces [0-9]* zero or more digits * zero or more spaces
Hi,
I am trying to set ulimit for soft stack unlimited, but this is not taking effect, after tracing the ulimit -a unlimited command, the below output was generated, which i am unable to comprehend. Could any one help me with this?
prcbap1-r10prod: truss -d ulimit -s unlimited
Tue Dec 30... (2 Replies)
Hi
i am studying about raid partion.i am not able to understand RAID level 5.
below is excerpt taken from tutorial.
RAID level 5
are they trying to say that the will be one extra disk which contain all the data. let says there are 4 disk. out of 4 , 3 disk are used for storing data and... (15 Replies)
I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist.
diff=$1$2.diff
id=$2 new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies
4. Post Here to Contact Site Administrators and Moderators
Variable I have in my shell script
diff=$1$2.diff
id=$2
new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff | awk -F'~' ''$2 == "$id"' {print $0}' > $new
I could see value of $id is not passing to the awk... (0 Replies)
Hi geeks,
I am trying to understand below if statement. can someone please explain me meaning of if condition.
if ]
then
echo -e "1"
fi
Thanks
Please use CODE tags. (3 Replies)
I m executing ps command and sorting it according to memory usage.
Please find the output of the command.
# ps aux --sort pmem
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 2060 624 ? Ss 01:54 0:00 init
root 2 0.0... (1 Reply)
Hi Guys,
Can someone please explain this code to me. I could figure out it's adding and comparing two fields but I am not sure which ones.
sort -t"|" -k3.1 /tmp/mpcashqc.xtr| awk -F"|" '{CHECKAMT+=$3;BATCHTOT=$4;\
items++}END{for(i in CHECKAMT) if (CHECKAMT!=BATCHTOT)... (6 Replies)
Hi
I am unable to understand the disk layout of one of my disk attached to v240. This is newly installed system from jumpstart.
I am unable to see the free space on backup slice 2 and there are 0 to 8 slices listed when I run format and print the disk info, also there is no reference of... (9 Replies)
i am not able to understand the following code for awk:
$awk -F"|" '{ kount++}
>END { for (desig in kount)
> print desig,kount }' emp.list
the input file i.e. emp.list is ::
3432| p.k.agrwal |g.m |sales
4566|g.l.sharma |director|production
3433|r shah | g.m | production... (1 Reply)
About associative nature of awk arrays i'm still confused, not able to understand yet how array element can be accessed based on a string, I got one example at gawk manual to illustrate associative nature of awk arrays, it goes here:
Codeawk '
# Print list of word frequencies
{
for (i = 1;... (3 Replies)