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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

manipulating information in awk (could use an array)?

Status
Not open for further replies.

odiedog2007

Technical User
Jul 25, 2007
1
CA
I have not done any programming in the last few years but I have a situation that has come up. I have multiple text files that make up a provincial grid file. Within each grid file there is information such as coordinates (latitue and longitude), range meridian, township values, etc. In my case, I have a value that comes up this way (roughly) r100, M50, W4M. In this example (R100 M50 and W4M), I need to be able to remove the R M and W M letters and only have the numbers left for the output file. I also need a few other values in different locations. The trick here is that the numbers between the R and M (range and meridian) can be 1 to 3 numbers in length (1 to 100 for each value) so these numbers are not always the same length and there maybe a case where the letters are there, but no numbers are there or maybe the letters are missing (I am not sure as I have not gone through the data files. Also there are more than 50 or more input files that I need to output as one file. Could someone help me with this request. If more information is needed, I can provide the information. As I said at the beginning, I am not a good programmer and I have been reading a little bit on AWK and understand some of it (1$ or $1 for first character, etc.).

Edward
 
I may be oversimplifying the problem, but could you just use the tr utility to strip out all "r", "w", "m" and "," characters from the files?

Some more sample input data and its corresponding output would be useful to explain your requirements.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top