Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. will27

    a problem on matching with function index()

    Please ignore the first question. still I would like to know what might be the possbile reason that the second and third "if" can not be executed while the first match (first if ) evidently doesn't hold.
  2. will27

    a problem on matching with function index()

    Hey, all I have been struggling with problem for quite a while, any hints of librating me from the fight will be highly appreciated. first there is a file "pool", the first col is something with will be matched by some key WorldComInc WorldCom, Inc. second there is file "key_trace"...
  3. will27

    sed script work, oneliner not work, what's the problem?

    Hi, thanks, PHV and feherke. I do agree with feherke that the this thread is somewhat off-topic, I assume people who has expertise on awk will also be familiar with sed. Anyway, the task can be pretty decently done with awk. Best
  4. will27

    sed script work, oneliner not work, what's the problem?

    Hi, all suppose I have following txt file "people" Tim US Xue CHN Will US Tom US Yong CHN if I work with a sedscript as following: /US$/ { s//USA/ w us.origin_1 } then following code works sed -n -f sedscript people However, its oneliner version as below doesn't sed '/US$/ {s//USA/; w...
  5. will27

    Joining columns

    suppose your data file is named "myfile" and an unique number at field 4 correspond to a unique name, do this awk 'BEGIN{FS=OFS=","} NR==FNR {namecode[$4]=$5;next} {print $1,$2,$3,namecode[$1],namecode[$1]}' myfile myfile tested and works! will27
  6. will27

    Find max and min by using array, get problem

    Hi, feherke Thank you for your tip and sorry for the confusion, I did some modification to fit the pseudo example when wrote this post but not careful enough. your code is succinct and elegant, howover, I am still wondering what's the problem with my code as following. awk...
  7. will27

    Find max and min by using array, get problem

    Hi, all The data is like following: ############## data #################### time name price 20050616 company2 32 19900112 company1 39 19980223 company2 44 20060523 company1 55 ############# job to be done ################ the job is simple, find the starting...
  8. will27

    how to pass parameters into regular expression, i.e., /parameter/

    thanks, futurelet the code works, the biggest problem turns out that the key field in keyfile contains "", this is disastrous, "" alway get a match. will
  9. will27

    how to pass parameters into regular expression, i.e., /parameter/

    thanks for the follow-up clarifications, and it is very helpful. one more question to futurelet, hope this will not bother you. I tried to extend your example to array, and apply them to follwoing two dataset(they are only a very small excerpts from the original dataset): get some...
  10. will27

    how to pass parameters into regular expression, i.e., /parameter/

    Hi, all thanks for the answer. first I am sorry the code is kind of confusing. what I really intend to do at the first line of the script is to read the first file. p5wizard, thanks for the answer, I did the same, it won't work. futruelet's code works great.thank you! I would appreciate it if...
  11. will27

    how to pass parameters into regular expression, i.e., /parameter/

    Hi, all I have been trying to find a way to pass parameters into regular expression, failed, so I am back. for example, I have following two files: # firstfile USA US United_States_of_America # secondfile x company USA US y Company xyz United_States_of_America what I want is to pass...
  12. will27

    use key to extract, extracted file has more keys than used to extract

    Thanks, feherke that helps a lot will
  13. will27

    use key to extract, extracted file has more keys than used to extract

    Dear feherke I really thank you so much and sorry for this late gratitude. Your code is several magnitude faster than mine and, most importantly, it spells out results as I want. However, I am still wondering where is the problem of my original code (I know it's ugly and will stick to the...
  14. will27

    use key to extract, extracted file has more keys than used to extract

    Hi, all I get many keys to extract records in other files. However, following scripts doesn't spell out what I expected. Both the keyfile and to be extracted files are tab dlimited. # keys in three column for keycol in 1 2 3 do # creat a vector...
  15. will27

    unconstant NF, want fields 1 to (NF-1) printed on same line.

    Thank you,Feherke I really appreciate your quic but big help . will Regards
  16. will27

    unconstant NF, want fields 1 to (NF-1) printed on same line.

    Dear all I am sure this is a simple quesiton for most people visiting this forum. the question in detail is as following: A data file with unconstant NF, the fields I want to reserve is field 1 to field (NF-1), they should be printed out on the same row. for example thank you for your kind...
  17. will27

    matching-by-key program unstable,any possible reason?

    Dear all What follows is a simple awk program with a shell wrapper. The problem is sometimes it works fine and sometime it won't. ########################################################## for ((i=1990;i<=2006;i++)) do awk 'BEGIN{FS=OFS="\t"} {if ($2==m) print $1,$3,$4}' m=$i GI> tmpGI awk...
  18. will27

    match by key, same code for files &quot;same format&quot;, one works one fails

    Hi,PH this time it works, thanks for all your help. One last question, this might have something to do with my own code. what's the default for the array to subscrbe itself? I printed out all the subs, they looks the same as in the key on all dimensions (of course the unque elements of the...
  19. will27

    match by key, same code for files &quot;same format&quot;, one works one fails

    Hi, PHV I cut and pasted the code, the problem is no output at all! when apply the same code to "wf1" and "wf2", the output is as following meta weight data country desc meta weight data country desc only title, nothing else. I do think your code is right, I checked all...
  20. will27

    match by key, same code for files &quot;same format&quot;, one works one fails

    Thanks for your quick response, PHV however, it won't work, I also tried some alternative of your codes, get nowhere. maybe I should simply try unix "join", though it is not wise to sort the file. will

Part and Inventory Search

Back
Top