Search Results

Search: Posts Made By: dev.devil.1983
2,231
Posted By Don Cragun
Assuming that your input sample is...
Assuming that your input sample is representative:
awk -F, -v sq="'" '{match($0, /".*"/); print $1, $4, $6, sq substr($0, RSTART+1, RLENGTH-2) sq, $(NF-1)}' file
seems to do what you want.

If...
3,532
Posted By stomp
Ahh. The new answer shows what I've missed to...
Ahh. The new answer shows what I've missed to read.

What's regarding the logout is the way you are calling your scripts:

. ./test.sh bla blub

calling a script with the dot-command(=".") is...
6,247
Posted By RudiC
As you can see, you have to go the extra mile to...
As you can see, you have to go the extra mile to achieve what you intended, and the eval has some caveats tagged to it. In recents shells, this could be done way easier using arrays:

DBname=($@)...
6,247
Posted By pravin27
export Numbr_Parms=$# export a=1 while [ $a...
export Numbr_Parms=$#
export a=1
while [ $a -le $Numbr_Parms ]
do
eval export DBName_$a=\$$a
echo DBName_$a
eval echo \$$DBName_$a
a=`expr $a + 1`
done
1,751
Posted By Scrutinizer
Another approach: awk...
Another approach:
awk '$1~/^Member/{gsub(/\n/,x); print $1,$2,$3,$4}' FS='[=]*"' OFS=, RS=\< file
Member name,Canada,Currency,CAD
Member name,UK,Currency,GBP
Member...
1,751
Posted By Klasform
Using sed (GNU sed) 4.2.2
Using sed (GNU sed) 4.2.2
1,751
Posted By Don Cragun
What operating system are you using? If...
What operating system are you using?

If you're using a Solaris/SunOS system try changing sed to /usr/xpg4/bin/sed to get a version that recognizes character classes (e.g., [[:alpha:]]).
1,751
Posted By Klasform
sed -n -r '/<Member/{N;...
sed -n -r '/<Member/{N; s/<(Member).*(name)="(.*)"\n(.*)="(.*)".*$/\1 \2,\3,\4,\5 /p}'This works fine!

For some reason, I was not able to do it using the [:alpha:] or [[:alpha:]]It seemed to be...
1,751
Posted By drl
Hi. With fgrep, paste, sed: #!/usr/bin/env...
Hi.

With fgrep, paste, sed:
#!/usr/bin/env bash

# @(#) s1 Demonstrate combining and transforming data, sed.

# Utility functions: print-as-echo, print-line-with-visual-space, debug.
#...
1,751
Posted By RavinderSingh13
Hello Dev, Could you please try following...
Hello Dev,

Could you please try following and let me know if this helps you.

awk '/<Member/{sub(/</,X,$0);sub(/[[:space:]]+/," ",$0);sub(/=\"/,OFS,$0);sub(/\"/,X,$0);A=$0}...
1,940
Posted By Akshay Hegde
Try $ cat file1 2013 2013 Make200...
Try

$ cat file1
2013 2013
Make200 Make201
Merc BMW
Jpur Del
PT PT
Aug Aug
G73 V_C A 2 7
G73 V_C B 2 7
G73 V_C C 2 7
G73 V_C D 2 7
G73 V_C E 2 7
G73...
1,940
Posted By Akshay Hegde
Try this then $ awk 'FNR==NR{A[$1 FS $2 FS...
Try this then

$ awk 'FNR==NR{A[$1 FS $2 FS $3]=$4 FS $5;next}(!/^[ \t]+/ && $1 FS $2 FS $3 in A){split(A[$2 FS $3],m);$4-=m[1];$5-=m[2]}1' file1 file2

I think you are working on Solaris and...
1,940
Posted By Akshay Hegde
Try I didn't get how come 2nd column all are...
Try

I didn't get how come 2nd column all are 7

$ awk 'FNR==NR{A[$2 FS $3]=$4 FS $5;next}($1=="G73" && $2 FS $3 in A){split(A[$2 FS $3],m);$4-=m[1];$5-=m[2]}1' file1 file2 >3rd_fileResulting
...
13,046
Posted By Scrutinizer
You are welcome. Yes, the standard ksh is ksh88...
You are welcome. Yes, the standard ksh is ksh88 and if you have dt installed there is a ksh93 version that is called /usr/dt/bin/dtksh. However, it is a version of ksh93 that is not recent enough for...
13,046
Posted By Scrutinizer
That would indicate Solaris 10. The ksh93 version...
That would indicate Solaris 10. The ksh93 version is not recent enough to support %T (and the underlying date system does not support "ago", for example)..

Your best bet may be to use perl . For...
1,306
Posted By RudiC
How about awk -F, 'NR==FNR {C[$1]=$2;next}...
How about awk -F, 'NR==FNR {C[$1]=$2;next}
($3 in C) {for (i=4; i<=NF; i++) $i*=C[$3]}
1
' CONVFMT="%.2f" OFS="," file2 file1
?
1,306
Posted By Akshay Hegde
@dev.devil.1983 ...
@dev.devil.1983 (https://www.unix.com/members/302128875.html)

try .. I modified it
Showing results 1 to 17 of 17

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