my i/p text looks like this,
FILE_TYPE=01|FILE_DESC=Periodic|FILE_SCHDL_TYPE=Daily|FILE_SCHDL=|FILE_SCHDL_TIME=9:00am|RESULTS=B
FILE_TYPE=02|FILE_DESC=NCTO|FILE_SCHDL_TYPE=Daily|FILE_SCHDL=|FILE_SCHDL_TIME=9:00am|RESULTS=M
NOTE Look carefully for the position FILE_TYPE,FILE_DESC etecetra etcetra
this position may varry, e.g. FILE_TYPE is here in 1st postion might be to-morrow in the 3rd or last postion,
So my query is to give the input search name, and it should display the field value, FILE_TYPE and value after = .
hey matrixmadhan, Field is not static, it might be changed across the file.
so according to the i/p search value, i want to fetch the field name and value .
hey lorcan , thanx a lot..can i have this in unix...not thru perl.
the first $1 is command line parameter comes from outside the script. so you can use your script this way from command line or call from an another program ;
thanx a lot...but if the field is going to change i.e. might be increased from 6 to 7 then , in real time it is not feasible to change the query to add one line $7 ~ srchname {print $7} !!!!!!
So i want irrespective of all the changes to i/p file, that we can think of, it should give us the o/p of the proper search value....but anyway thanx a lot.
lorcan, i tried your one it works fine , with some modification according to my requirement ....But still can we have some more modularized one...using AWK or SED.
i tried this code it works fine . You don't have to use 6 or 7 fields . you can can write more than from the possibilities. for e.g print $8,..print 12 etc.
Thanx a lot, it's working.....
can i put the o/p into arrays ,
e.g. if my srch pattern "FILE_TYPE"
then the values of FILE_TYPE should store in array of file_type .
let think of my current sample,
1 i have given the search pattern as "FILE_TYPE"
then the query should store the FILE_TYPE values into array "FILE_TYPE"[index] { index is 1,2,3......etc }
2 i have given my next search pattern as "FILE_DESC"
then the query should store the FILE_DESC values into array "FILE_DESC"[index] { index is 1,2,3......etc }
if i am going to put all this into one function, and trying to call that function
with the variable as search pattern, then it is showing me END OF FILE error,
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post or send a private message where your goal is to get an answer more quickly.
The two threads have been merged.
To be honest, I can't see the point in posting a question twice, sending a private message, and 'bumping-up' your post after an hour. I'm not even in the same time-zone.