Search Results

Search: Posts Made By: aigles
7,513
Posted By aigles
A possible solution : $ cat ./eshaqur.sh awk...
A possible solution :
$ cat ./eshaqur.sh
awk '
function printValues() {
if (Values) {
print S, Date, Value["NSMSSMRLTOT"],
...
1,166
Posted By aigles
Only GNU version of grep supports the -A option. ...
Only GNU version of grep supports the -A option.

You can do something like that :
awk '
NR==FNR { pattern[">" $1] ; next }
$1 in pattern { print; print_next=1; next }
print_next--...
3,367
Posted By aigles
First, there are missing $ in your script : if...
First, there are missing $ in your script :
if [ "$varSSCode" == "11" -o "$varSSCode" == "56" -o "$varSSCode" == "93" ]; then


A possible solution (using a list of values, not an array)...
5,395
Posted By aigles
Another way : Last=0 while : do ...
Another way :
Last=0
while :
do
Line=$(wc -l < moo.txt)
awk "NR>$Last {p=1}p" moo.txt #pipe this to log analyzer program
Last=$Line
sleep 10
done


Jean-Pierre.
2,930
Posted By aigles
Replace space before awk : #!/bin/ksh ...
Replace space before awk :
#!/bin/ksh
filesrc=/usr/kk/Source1.txt
filetgt=/usr/kk/Source2.txt

FINAL_COUNTS=`awk '{n++} END {printf "%012d\n",n}' ${filesrc} ${filetgt}`
 
echo 'Final Count...
1,035
Posted By aigles
cmp -l lewis_1.txt lewis_2.txt | awk -v Q="'" '...
cmp -l lewis_1.txt lewis_2.txt |
awk -v Q="'" '
function oct2dec(o ,i,d){
for(i=1;i<=length(o);++i){
d=(8*d)+substr(o,i,1);
}
return d
}
{
offset = $1 - 1;
old =...
7,203
Posted By aigles
From gawk documentation : Try : awk '{...
From gawk documentation :

Try :
awk '{ if($0 ~ /^http:\/\/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]{1,3}\.[0-9]\{1,3\}(:[0-9]\{1,5\})?/) print $0}' f7


I test the original awk command with some...
1,035
Posted By aigles
You can do something like that : $ cat...
You can do something like that :
$ cat lewis.ksh
cmp -l lewis_1.txt lewis_2.txt |
awk -v Q="'" '
function oct2dec(o ,i,d){
for(i=1;i<=length(o);++i){
d=(8*d)+substr(o,i,1);
}
...
3,536
Posted By aigles
Another way : $ result=val1,val2 $...
Another way :
$ result=val1,val2
$ v1=${result%%,*}
$ v2=${result##$v1,}
$ echo $v1
val1
$ echo $v2
val2
$


Jean-Pierre.
1,280
Posted By aigles
You can do something like that : awk ' { ...
You can do something like that :
awk '
{
Times[$5,++Job[$5]] = $2;
}
END {
for (j in Job) {
printf "%-8s : %s\n", j, (Job[j] >= 4 ?...
1,196
Posted By aigles
Try and adapt the following awk script that makes...
Try and adapt the following awk script that makes all the work (I hope) :
awk -v FS='[][()]' '

FNR==1 {
printLookup();
FileName = FILENAME;
}

/CMN_1716 Lookup/ {...
6,952
Posted By aigles
Try and adapt this awk script : awk -v FS='|'...
Try and adapt this awk script :
awk -v FS='|' -v OFS='|' '
{
if (MaxFields < NF) MaxFields = NF;
for (i=1; i<=NF; i++) {
Field[NR, i] = $i;
l =...
4,545
Posted By aigles
#!/bin/ksh PROG=$0;export PROG ...
#!/bin/ksh
PROG=$0;export PROG
PATH=/usr/informent/dv03/bin:$PATH;export PATH
ORAUSER=`get_inf_env INFORM_DB_ACCOUNT`;export ORAUSER
BATCH_HOME=`get_inf_env INFORM_DATA_HOME`


Jean-Pierre.
2,027
Posted By aigles
Try: value=2 sed...
Try: value=2
sed "s!\(<num_clusters>\)[0-9]*\(</num_clusters>\)!\1${value}\2!" 1_cluster_TTP.dat.xml

Jean-Pierre.
889
Posted By aigles
Another way with ksh or bash (with extglog option...
Another way with ksh or bash (with extglog option set) :
if [[ "${a}" == @(one|two) ]]

Jean-Pierre.
1,827
Posted By aigles
From crontab you can do : minute hour...
From crontab you can do :
minute hour day_of_month month day_of_week your_script.sh%1%yes%n%64

Jean-Pierre.
1,098
Posted By aigles
Try: sed...
Try:
sed "s/$title:$author:$price:$qtyAvailable:$qtySold/$Ntitle:$author:$price:$qtyAvailable:$qtySold/"

Jean-Pierre.
1,419
Posted By aigles
One way:var=9235793579usa9485 if [[ "$var" =...
One way:var=9235793579usa9485
if [[ "$var" = *[a-zA-Z]* ]]
then
print "String contains alphabetic characters"
else
print "No alphabetic character."
fi


Jean-Pierre.
12,800
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...
9,012
Posted By aigles
Merge the two tr statement into one : echo...
Merge the two tr statement into one :
echo "$string1 $string2" | tr ' |' '\n\n'

Jean-Pierre.
9,012
Posted By aigles
a pure shell (ksh) solution :#!/usr/bin/ksh ...
a pure shell (ksh) solution :#!/usr/bin/ksh

string1='abc|def|hij'
string2='12|13|14'
string3=''

oIFS="${IFS}"
IFS='|'

set -A str1 ${string1}
set -A str2 ${string2}

IFS="${oIFS}"
...
1,195
Posted By aigles
You can do something like that : $ cat...
You can do something like that :
$ cat aswex.ksh

FileList=./aswex.dat
LastFile=./aswex.dat.last

touch ${LastFile}
(( last = $(<${LastFile}) + 0 ))

print "Starting from line $((last+1))"...
3,629
Posted By aigles
You can do something like that :nawk -F': *' ' ...
You can do something like that :nawk -F': *' '
$1=="Increment By" { Inc = $2; next }
$1=="Max Value" { Max = $2; next }
$1=="Related Table" { Tbl = $2; next }...
3,621
Posted By aigles
Sorry, the alternate version of the function...
Sorry, the alternate version of the function SplitString was written too quickly and untested.
A new version (tested) :
function SplitString(str ,i ,j ,char ,slen ) {
slen = length(str);...
3,621
Posted By aigles
Replace the SplitString function : function...
Replace the SplitString function :
function SplitString(str ,i ,j ,char ,slen ) {
slen = length(str);
for (i=1; i<=slen; i++)
char = substr(str, i, 1);
if (char ~...
Showing results 1 to 25 of 58

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