Visit The New, Modern Unix Linux Community

Search Results

Search: Posts Made By: rock1
1,225
Posted By rock1
thank you all for your valuable inputs. i can...
thank you all for your valuable inputs. i can incorporate this now:

code

#!/bin/sh

var1=1,23,234,1
var2=a,ab,xyz,z
var3=0,0,0,1
var4=0,0,0,1


len=`echo $var1 | awk -F '[,]' '{print ...
1,225
Posted By rock1
So the number of values in the variables may not...
So the number of values in the variables may not be the same always. So should I can calculate the length first and use that in the code. This example has 3 for each variable.. but it could be 2 or...
1,225
Posted By rock1
sorry i meant the number of variable value in...
sorry i meant the number of variable value in each variable will always be the same. if var1 has 3 comma separated values so will var2 and var 3.

---------- Post updated at 12:47 PM ----------...
1,225
Posted By rock1
Loop with multiple delimited variables
hi,

i need a portion in a audit logging shell script where i have to loop thru multiple variables.
I need some help in accomplishing this. i have 3 variables
var1=1,23,234
var2=a,ab,xyz...
834
Posted By rock1
when i ran on oct 1st 2011 it gives 201110 as...
when i ran on oct 1st 2011 it gives 201110 as the year month itself instead of 201109.

i am not sure if it is taking minus 30 days back only.

thanks

---------- Post updated 11-04-11 at...
834
Posted By rock1
Previous yearmonth in filename
Hi,

I have a script that is looking for Files with a previous Year-month format. example if the script runs anyday in Oct2011 it has to look for Sept2011 files.
it looks for FILENMAE_201109.TXT....
3,284
Posted By rock1
Thanks!
Thanks!
3,284
Posted By rock1
Also i could understand the code. hope i am...
Also i could understand the code. hope i am right.

Look for pattern date. define an array and store the whole row in it.
n=NR - record number
If pattern is TEST and NR=7 print the array.
3,284
Posted By rock1
Thank you radoulov and rahul for your response. ...
Thank you radoulov and rahul for your response.

I tried your script radoulov and it works just perfect.. onlt thing is i dont have he date as the first field so i removed the ^ in the pattern.
...
3,284
Posted By rock1
here is my script... this gives me all the dates...
here is my script... this gives me all the dates offcourse:
I remove the last few lines and look for date and cleanse based on the data and write it with the filename,
rm 45days_dates.txt
for file...
3,284
Posted By rock1
Grep for a pattern based on another patter
hi,

I have looked at many grep threads and am unable to find something like this: please help.
I have a file which is generated from a report generator and i am trying to load a whole lot of...
8,279
Posted By rock1
Thank you so much for your time and effort in...
Thank you so much for your time and effort in helping me! FNR example and illustration was simply great.. Anybody can understand it if read :)
8,279
Posted By rock1
sorry for so many questions.. also i am not...
sorry for so many questions..

also i am not clear on this line:

print l[j]FS r[l[j]~/Total/?c++:c?c:++c]

print all but the last 6 values of the array named l concatenating to them the...
8,279
Posted By rock1
thank you so much.. i understand it much better...
thank you so much.. i understand it much better now.. however i do have some basic questions..

NR == FNR this condition I am little confused..
While reading the first non-empty input file (NR...
8,279
Posted By rock1
the reason i ask is i must be able to modify...
the reason i ask is i must be able to modify it,... what if they want the summary as well i must be able to add those lines with some dummy date or with date blank..

thanks
8,279
Posted By rock1
thanks a ton!! Yes it correct now.. the code is...
thanks a ton!! Yes it correct now.. the code is a liitle difficult for my level of expertise :( I havent used arrays much.. If you can help me underatnad it a little i would appreciate it,
...
8,279
Posted By rock1
Her eis the putput i am getting: FILENAME2...
Her eis the putput i am getting:

FILENAME2 Open 3:45 3:40 218 7 10296 First, Last Date: 09/17/08
FILENAME2 Closed 0:00 0:00 0 1 10296 First, Last Date:...
8,279
Posted By rock1
I have preapred the files exactly as the input...
I have preapred the files exactly as the input files i am using: The ones highlighted are the summary lines. I have about 28 lines in file1 and 142 lines in file2. thanks

file1:
FILENAME1 xxxxx...
8,279
Posted By rock1
thank you .. i tested this code... it working...
thank you .. i tested this code... it working fine but it putting one extra line at the end of each file

FILENAME1 Open xxxx Date: 09/01/08
;
;
;
;
FILENAME2 Open zzzz (no date)
...
8,279
Posted By rock1
sorry..correction ..its 7 lines not 6.
sorry..correction ..its 7 lines not 6.
8,279
Posted By rock1
this is clearer i guess: FILENAME1 XXXXX...
this is clearer i guess:

FILENAME1 XXXXX FOO BAR Date: 09/01/08
FILENAME1 XXXXX FOO BAR Date: 09/02/08
FILENAME2 XXXXX FOO BAR Date: 09/01/08

FILENAME1 Open 3:45 3:43
FILENAME1 Closed 0:00...
8,279
Posted By rock1
The summary line is the same format except that...
The summary line is the same format except that its the last 6 lines of each file.so everytime the filename changes.. the last 6 lines are summary lines and wont have a entry in the first file.
...
8,279
Posted By rock1
yes i removed the summary and the code ran fine,...
yes i removed the summary and the code ran fine, It produces the exact output,. I will have to omit the summary in my extract or this code has to omit the last Total block everytime the filename...
8,279
Posted By rock1
That is indeed correct..however i did some...
That is indeed correct..however i did some analysis and found that there was a summary record in the input file that was creating one extra Total record in file2!!!!

I will think of a way to...
8,279
Posted By rock1
this script you have me first is giving me what...
this script you have me first is giving me what i need

#!/bin/sh
awk 'NR == FNR {
t = $1
sub(/[^ \t]* /, "")
_[t] = $0
next
}
($1 in _ && /Total/ && $0 = $0 FS _[$1]) || 1
'...
Showing results 1 to 25 of 33

 

Featured Tech Videos

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