Search Results

Search: Posts Made By: shash
1,586
Posted By apmcd47
Not sure if this is safe: . ./config_env.txt ...
Not sure if this is safe:
. ./config_env.txt
while read line
do
eval echo $line >>new_properties.txt
done < ./config_properties.txt
Each line is evaluated first, expanding any shell...
2,580
Posted By rdrtx1
awk ' NR==FNR { ...
awk '
NR==FNR { # for first file
c=0; # set column counter to 0
...
2,580
Posted By rdrtx1
awk ' NR==FNR {c=0; for (i=4; i<=length; i+=2)...
awk '
NR==FNR {c=0; for (i=4; i<=length; i+=2) a[substr($0,1,3),c++]=substr($0,i,2); next }
{
sub(substr($0,1,7),substr($0,1,3));
c=0;
l=substr($0,1,3);
for (i=4; i<=length; i+=2)...
2,580
Posted By Don Cragun
Hi Shash, Your desired output doesn't make any...
Hi Shash,
Your desired output doesn't make any sense to me. When you find lines in both files for a given key, the data from the fields in both files are intermixed. When data is only found in one...
2,580
Posted By RudiC
How about - for exactly your sample files given...
How about - for exactly your sample files given in post#1 -
awk '
{$0 = substr($0,1,3) " " substr($0,length-3,2) " " substr($0,length-1,2)
}

NR == FNR ...
1,218
Posted By pravin27
awk -F";" '{if ($3"|"$4 != prev ) {print...
awk -F";" '{if ($3"|"$4 != prev ) {print }prev=$3"|"$4}' filename
1,618
Posted By RudiC
Would this work:sed 's/|/<\/td><td class="metric"...
Would this work:sed 's/|/<\/td><td class="metric" align="right">/6; s/|/<\/td><td class="metric">/g; s/^/<tr><td class="metric">/; s/$/<\/td><\/tr>/' file
<tr><td class="metric">20150731</td><td...
2,304
Posted By RudiC
While the single-quote-flag is discussed in e.g....
While the single-quote-flag is discussed in e.g. my (linux) man printf it is not in FreeBSD. So its behaviour depends on the implementation.
bash (4.3.42(1)-release):printf "%'.2f\n"...
1,220
Posted By RudiC
That's because of the e-mail-client is using a...
That's because of the e-mail-client is using a true type font.
You'll need to either select a monospace font or send an HTML file.
2,304
Posted By RudiC
Bit simpler? Tryawk -F'|' ' ...
Bit simpler? Tryawk -F'|' '
{IX = $1 FS $2
}
FNR==NR {T3[IX] = $3
T4[IX] = $4
next
}
IX in T3 ...
2,304
Posted By Yoda
Here is an awk approach:- awk -F\| ' ...
Here is an awk approach:-
awk -F\| '
NR == FNR {
A[$1 FS $2] = $0
next
}
($1 FS $2) in A {
split(A[$1 FS $2], T)
...
3,089
Posted By bakunin
Why? If it is a variable you can define it in any...
Why? If it is a variable you can define it in any way you want, no?

Or is it some external input you need to use? In this case: how did it get into this variable? Perhaps there is a better way to...
3,089
Posted By RudiC
You might try sth. along this line (tested in...
You might try sth. along this line (tested in bash):OI="$IFS"
IFS=,
table_arr=($table_name)
col_arr=($col_name)
IFS="$OI"
3,089
Posted By bakunin
Yes, there is. But in fact there is a better (and...
Yes, there is. But in fact there is a better (and MUCH better readable) way to accomplish this if you use arrays - a feature almost every modern shell offers:

#! /bin/ksh

table[1]="table1" ;...
2,856
Posted By RudiC
Not sure what you require. Would this fit your...
Not sure what you require. Would this fit your needs:IFS=","; for i in $src1; do src2=$i; echo $src2; done
2,856
Posted By bakunin
You might want to give this a try: while...
You might want to give this a try:

while IFS="=" read part1 part2 ; do
print - "part1 is: $part1 part2 is $part2"
done < /path/to/file

Where file might contain:

part1=part2
a=b...
Showing results 1 to 16 of 16

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