Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
300080154 06/18/2004 14:35:56 LINK CHANGE Detected
500080149 06/18/2004 15:49:56 LINE CHANGE Detected
700080151 06/21/2004 09:06:45 POINT CHANGE Detected
200080154 06/21/2004 09:49:00 LINK CHANGE Detected
700080154 06/21/2004 10:41:08 POINT CHANGE Detected
300080154 06/18/2004 14:35:56 LINK CHANGE Detected
500080149 06/18/2004 15:49:56 LINE CHANGE Detected
700080151 06/21/2004 09:06:45 POINT CHANGE Detected
200080154 06/21/2004 09:49:00 LINK CHANGE Detected
700080154 06/21/2004 10:41:08 POINT CHANGE Detected
#!/usr/bin/perl
while (<DATA>) {
($num, $date, $time, $LLP, $change, $detected) = split (/\s+/, $_);
print "$num $date $time $LLP";
print " " x (7 - (length $LLP));
print "$change $detected\n";
}
__DATA__
300080154 06/18/2004 14:35:56 LINK CHANGE Detected
500080149 06/18/2004 15:49:56 LINE CHANGE Detected
700080151 06/21/2004 09:06:45 POINT CHANGE Detected
200080154 06/21/2004 09:49:00 LINK CHANGE Detected
700080154 06/21/2004 10:41:08 POINT CHANGE Detected
[red]300080154 06/18/2004 14:35:56 LINK CHANGE Detected
500080149 06/18/2004 15:49:56 LINE CHANGE Detected
700080151 06/21/2004 09:06:45 POINT CHANGE Detected
200080154 06/21/2004 09:49:00 LINK CHANGE Detected
700080154 06/21/2004 10:41:08 POINT CHANGE Detected[/red]
MAX=`awk 'BEGIN{max=0} {{len=length($4)} if(len > max) max=len} END{print max}' infile`
cat infile | head -20 | sed 's! *! !g' | awk '{printf("%0s %0s %0s %"'"$MAX"'"s %0s\n", $1, $2, $3, $4, substr($0,index($0,$5)))}' >> outfile
cat infile | sed 's! *! !g' | awk 'NR<21{printf("%0s %0s %0s %-"'"$MAX"'"s %0s\n", $1, $2, $3, $4, substr($0,index($0,$5)))}' >> outfile
I would appreciate if you can tell how to remove "cat" and "sed" from above.
TOTALCOUNT=$(wc $TMP | awk '{print $1}')
MAX=`awk 'BEGIN{max=0} {{len=length($4)} if(len > max) max=len} END{print max}' $TMP`
spaces=""
i=0
while [ $i -le ${MAX}-9 ]
do
spaces="$spaces "
i=`expr $i + 1`
done
300080154 06/18/2004 14:35:56 LINK CHANGE Detected
500080149 06/18/2004 15:49:56 LINE CHANGES Detected
700080151 06/21/2004 09:06:45 POINT CHANGE Detected
200080154 06/21/2004 09:49:00 LINK CHANGES Detected
700080154 06/21/2004 10:41:08 POINT CHANGE Detected
sed 's/ */\t/g' DATA
awk '{
for (col=1; col<=NF; col++) {
if (max[col] < length($col))
max[col] = length($col)
arr[NR, col] = $col
}
}
END {
for (row=1; row<=NR; row++) {
for (col=1; col<=NF; col++)
printf "%-" max[col] "s ", arr[row,col]
print ""
}
}' file1
0000000083942 07/07/2004 08:17:00 aaaaaaaaaa 2393286 ORA-02290: check constraint violated
0008015669997 07/07/2004 14:21:28 aaaaaaaaaaaaaaaaaaaaaaaaaaa 43434343 Primary Violation
0000000149033 07/07/2004 14:21:28 aaaaaaaaaaaaaaaaa 2933101 ORA-00001: unique constraint violated
0008015696891 07/08/2004 08:23:40 aaaaaaaaaaa 3093754 Primary Violation
0000000083942 07/07/2004 08:17:00 aaaaaaaaaa 2393286 ORA-02290: check
0008015669997 07/07/2004 14:21:28 aaaaaaaaaaaaaaaaaaaaaaaaaaa 43434343 Primary Violation
0000000149033 07/07/2004 14:21:28 aaaaaaaaaaaaaaaaa 2933101 ORA-00001: unique
0008015696891 07/08/2004 08:23:40 aaaaaaaaaaa 3093754 Primary Violation
0000000083942 07/07/2004 08:17:00 aaaaaaaaaa 2393286 ORA-02290: check constraint violated
0008015669997 07/07/2004 14:21:28 aaaaaaaaaaaaaaaaaaaaaaaaaaa 43434343 Primary Violation constraint violated
0000000149033 07/07/2004 14:21:28 aaaaaaaaaaaaaaaaa 2933101 ORA-00001: unique constraint violated
0008015696891 07/08/2004 08:23:40 aaaaaaaaaaa 3093754 Primary Violation constraint violated
0000000083942 07/07/2004 08:17:00 aaaaaaaaaa 2393286 ORA-02290: check constraint violated
0008015669997 07/07/2004 14:21:28 aaaaaaaaaaaaaaaaaaaaaaaaaaa 43434343 Primary Violation constraint violated
0000000149033 07/07/2004 14:21:28 aaaaaaaaaaaaaaaaa 2933101 ORA-00001: unique constraint violated
0008015696891 07/08/2004 08:23:40 aaaaaaaaaaa 3093754 Primary Violation constraint violated
Normally it doesn't work for me too, inserting the two characters '\t' for sed. I don't know which change made it work yesterday. (hey - it's still working!).sed 's/ */\t/g' DATA
How come \t is not printing tab? It is printing letter t
I also tried \\t and '\t'
s/ */\t/g
[code]
(replace the \t with a real tab).
and call:
[code]
sed -f blank2tab.sed DATA > DATA.out
[code]
An alternative is, to convert multi-blanks to one, and use 'tr' afterwards:
[code]
sed 's/ */ /g' DATA | tr " " "\t"
[code]
seeking a job as java-programmer in Berlin: [URL unfurl="true"]http://home.arcor.de/hirnstrom/bewerbung[/URL]
sed 's/ */\t/g' DATA
How come \t is not printing tab? It is printing letter t
I also tried \\t and '\t'
s/ */\t/g
sed -f blank2tab.sed DATA > DATA.out
sed 's/ */ /g' DATA | tr " " "\t"