Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: giannicello
9,317
Posted By giannicello
Thank you. I'll save for when I have to reformat...
Thank you. I'll save for when I have to reformat just the dates in a file. For this task, I had to reformat other fields at the same time if they exist like phone number, zip codes, etc., while...
9,317
Posted By giannicello
Thank you so much! That's what I was looking for...
Thank you so much! That's what I was looking for actually.
I thought we needed to show what we wrote to get help. My awk skill is apparently not very good but this works for me!

Sample Input:

...
9,317
Posted By giannicello
Thanks. It worked but I may have to ditch awk and...
Thanks. It worked but I may have to ditch awk and do a while read instead on all million+ lines and format it that way. I wanted to use awk since it's always been super fast but doesn't seem like it...
9,317
Posted By giannicello
Perhaps it's AIX but it didn't work: awk 'BEGIN...
Perhaps it's AIX but it didn't work:
awk 'BEGIN {FS=","}{ printf %s, $1 ; if ( $2=="" || $2==" ") print $2; else print substr($2,7,4)"-"substr($2,1,2) "-" substr($2,4,2), $3, $4, $5, $6 } ' a.dat...
9,317
Posted By giannicello
Awk if-else syntax with multiple columns
I can't seem to get this to work.
I can reformat the date field if it's the first field (and only field) in the file:




However, I get a syntax error when the date field is the second field...
1,897
Posted By giannicello
I see. I don't believe there is a way to hide the...
I see. I don't believe there is a way to hide the account behind the name but then again, I've never tried to do it that way.
1,897
Posted By giannicello
If your IT Support group has a email address,...
If your IT Support group has a email address, then "-r itsupport@mycompany.com" is what we're saying.
8,297
Posted By giannicello
You can try % or %%. ${variable%%.*}
You can try % or %%. ${variable%%.*}
1,897
Posted By giannicello
Have you tried '-r', ex. -r...
Have you tried '-r', ex. -r "cnraja@host.com"?
2,084
Posted By giannicello
If you didn't have the exit 0 in the trap, I...
If you didn't have the exit 0 in the trap, I think it will continue.
Try looking at this - Unix - Signals and Traps (http://www.tutorialspoint.com/unix/unix-signals-traps.htm)
2,738
Posted By giannicello
Where is the ending tick (`)? Also, have you...
Where is the ending tick (`)? Also, have you tried quoting "HTA_ResponseStatus: 500"?
1,074
Posted By giannicello
How do I save a post?
I have run into old threads/posts that I'd like to save for future reference.
Is there a way to mark the thread or save to my favorite? Is this the same as subscribing? I don't really want to...
3,617
Posted By giannicello
How quickly did awk/nawk do it with sub/gsub?...
How quickly did awk/nawk do it with sub/gsub? Just curious.
16,342
Posted By giannicello
You said you are calling the script with the...
You said you are calling the script with the function from another script. You should capture what you pass to that script outside of the function, no?
12,480
Posted By giannicello
I usually just do it this way, if I need to get a...
I usually just do it this way, if I need to get a count for reporting or other uses:


sqlplus -s "${USR}/${PSS}@${DB}" <<EOF > $OUT_FILE
WHENEVER SQLERROR EXIT 1;
SET ECHO OFF...
10,029
Posted By giannicello
Wow. Thank you so much everyone!! I like the +0...
Wow. Thank you so much everyone!! I like the +0 solution for it's simplicity.

-Gianni
10,029
Posted By giannicello
Combining gsub and substr in awk
I have data a.txt:


I want to reformat file to look like this:



basically with the 3rd columns having leading zeros removed.

My code a.awk:

awk '{ v=substr($0, 48,10); print...
5,572
Posted By giannicello
Awesome. Thanks everyone!
Awesome. Thanks everyone!
5,572
Posted By giannicello
Cool. I tried it and it seems to work fine except...
Cool. I tried it and it seems to work fine except for the first space then ':' but it gives me what I need:



Thank you!
Gianni
5,572
Posted By giannicello
Merge lines from one file if pattern matches
I have one comma separated file (a.txt) with two or more records all matching except for the last column.
I would like to merge all matching lines into one and consolidate the last column, separated...
1,290
Posted By giannicello
What if you changed it to this: if grep -q...
What if you changed it to this:
if grep -q "$Title" Hello1 | grep -q "$Price" Hello1 ; then #-- line 7
13,848
Posted By giannicello
How about: username="root" ...
How about:

username="root"
password="password"
telnet 102.240.101.223
spawn
expect "login:"
send "$username\r"
expect "password:"
send "$password\r"
send "exit\r"
expect eof
4,235
Posted By giannicello
Why can't you just add the command to kick off...
Why can't you just add the command to kick off the second script (b.ksh) inside the first script (a.ksh) at the end?
4,106
Posted By giannicello
You may need to specify the file separator...
You may need to specify the file separator (FS="|") as in awk 'BEGIN {FS="|"}{ arr1[$1]++
2,318
Posted By giannicello
From what I can tell, you should have spaces...
From what I can tell, you should have spaces around " != " as in [ $SIZE_64 != $ZERO ]
Showing results 1 to 25 of 187

 

Featured Tech Videos

All times are GMT -4. The time now is 04:42 AM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy