Search Results

Search: Posts Made By: selvankj
2,180
Posted By bartus11
Try:sed 's/^/XYZ|/' file
Try:sed 's/^/XYZ|/' file
2,180
Posted By RavinderSingh13
Hello, Could you please try the following...
Hello,

Could you please try the following command for same.


awk '{print "XYZ|"}'1 ORS="" filename


It will show output as follows.


XYZ|12||34|56|78



Thanks,
R. Singh
2,982
Posted By jim mcnamara
awk -F '|' ' $3 =="Y" && $4=="0" && $6=="N"...
awk -F '|' ' $3 =="Y" && $4=="0" && $6=="N" {var1++}
$3 =="Y" && $6=="N" {var2++}
{next}
END{print "condition 1", var1, " condition2", var2}'...
2,982
Posted By MadeInGermany
The exclusive stuff with next inawk -F '|' ' ...
The exclusive stuff with next inawk -F '|' '
$3 =="Y" && $4=="0" && $6=="N" {var1++}
$3 =="Y" && $6=="N" {var2++}
END {
print "condition1", var1+0
print "condition2", var2+0
}
'...
2,982
Posted By jethrow
Like this? awk -F"|" '{ if ($3=="Y" && $4==0...
Like this?
awk -F"|" '{
if ($3=="Y" && $4==0 && $6=="N")
variable1++
if ($3 =="Y" && $6=="N")
variable2++
}
END {print "variable1=" variable1 "\nvariable2=" variable2}' inputfil
4,785
Posted By itkamaraj
not tested nawk -F"," ' /^3/ { { ...
not tested


nawk -F"," ' /^3/ {
{
if(index($13,"-") > 0)
{
$13=substr($13,2,length($0))"-"
}
print($13,"5",$1,$28,"$27",$26)
}' $FILENAME >> New_file
4,785
Posted By ltomuno
awk '{print $0<0?-$0"-":$0}'...
awk '{print $0<0?-$0"-":$0}' inputfile
7,581
Posted By curleb
Yes. I'd start you off w a hint such as:...
Yes. I'd start you off w a hint such as: %035.35s.

However, the most effective approach for you overall is to scrounge up a tutorial that covers printf. Really the same features and behavior...
7,581
Posted By bartus11
Try: printf "%015.2f%c%015.2f\n" $v1 $v3...
Try: printf "%015.2f%c%015.2f\n" $v1 $v3 $v2
7,581
Posted By curleb
different shell and OS, but...you're just mixing...
different shell and OS, but...you're just mixing metaphors with the printf formatting directions. %d is decimal, where you inputs are float...%f. The +-char needs to be treated as a string, and...
12,902
Posted By bartus11
Use printf "%.2f",credit in the END...
Use printf "%.2f",credit in the END section.
12,902
Posted By bartus11
When specifying multiple variables, you need to...
When specifying multiple variables, you need to put -v in front of each of them:nawk -v FD="$F_D" -v SS="$S_S" -v DS="$D_S" 'BEGIN {FS=","} {printf("%-1s%-4s%-30s","0",$2,FD,SS,DS)}'
12,902
Posted By aigles
1) Add -v options nawk -v FD="$F_D" -v SS="$S_S"...
1) Add -v options nawk -v FD="$F_D" -v SS="$S_S" -v DS="$D_S" 'BEGIN {FS=","} {printf("%-1s%-4s%-30s","0",$2,FD,SS,DS)}'

2) Remove loop (cat,grep while read) :nawk -v FD="$F_D" -v SS="$S_S" -v...
4,743
Posted By Neo
Do not post classroom or homework problems in the...
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum (https://www.unix.com/homework-coursework-questions/) under special...
Showing results 1 to 14 of 14

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