Parsing info from a text file into an IDL procedure


 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications Parsing info from a text file into an IDL procedure
# 1  
Old 09-30-2008
Parsing info from a text file into an IDL procedure

Hi,

I hope this is appropriate for this forum.

I have a text file (test.txt) that contains information that I would like to parse into an IDL procedure. Each line of the text file is either a number or a string, which will be a variable in my IDL procedure. Therefore I want to read each line of the text file and store it as a separate variable. I think I have figured out how to do that.

openr, lun, 'test.txt', /get_lun
readf, lun, IDL_var#
'' '' ''
'' '' ''
free_lun, lun

The above code works if the lines of the text file are numbers. If the line is a string then I must first have: IDL_var#=''. This has worked so far because I have constructed my text file so that the IDL code knows which lines will be numbers, and which will be strings.

Here are my questions:

- Is there a better way to parse info from a text file into an IDL procedure?
- IMPORTANT: I currently have a variable that I would like to pass into the IDL procedure which will either be a string or a number. How can I make readf function blind to this? I won't be able to tell it in advance the type of variable.

Thank you for any help,
Mike
# 2  
Old 10-11-2008
Apparently no one understood your question. I myself don't know what you mean by IDL. The syntax you have in your example doesn't look like code I'm familiar with.

There are lots of tools in UNIX to parse stuff and extract info. The basics in increasing order of complexity and power are:
read (shell function)
  • cut
  • sed
  • awk
  • perl

I commend you to try again. Hopefully next time someone will pick up the thread.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to extract info from text file between the tags

Hi, I have a text file with member information... B]Name is in H1 tag Title is in H2 tag Email is in <a id="ctl00_ContentPlaceHolder3_repeaterItems_ctl01_lbnEmailMe" href="javascript:__doPostBack('ctl00$ContentPlaceHolder3$repeaterItems$ctl01$lbnEmailMe','')">someone@company.com</a> Location:... (6 Replies)
Discussion started by: igurv
6 Replies

2. Shell Programming and Scripting

Parsing text file

Hi Friends, I am back for the second round today - :D My input text file is this way Home friends friendship meter Tools Mirrors Downloads My Data About Us Help My own results BLAT Search Results ACTIONS QUERY SCORE START END QSIZE IDENTITY CHRO STRAND ... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

3. Shell Programming and Scripting

Parsing text file

I'm totally stumped with how to handle this huge text file I'm trying to deal with. I really need some help! Here is what is looks like: ab1ba67c331a3d731396322fad8dd71a3b627f89359827697645c806091c40b9 0.2 812a3c3684310045f1cb3157bf5eebc4379804e98c82b56f3944564e7bf5dab5 0.6 0.6... (3 Replies)
Discussion started by: comp8765
3 Replies

4. Programming

Parsing a Text file using C++

I was trying to parse the text file, which will looks like this ###XYZABC#### ############ int = 4 char = 1 float = 1 . . ############ like this my text file will contains lots of entries and I need to store these entries in the map eg. map.first = int and map.second = 4 same way I... (5 Replies)
Discussion started by: agupta2
5 Replies

5. Shell Programming and Scripting

Help to get the Output of PL/SQL procedure In a Excel or Text File

Hi, Could anyone please guide me to get the output of the PL/SQL procedure in a Excel file or Text File... Thanks (1 Reply)
Discussion started by: funonnet
1 Replies

6. Shell Programming and Scripting

Need help parsing a text file

I have a text file: router1#sh ip blah blah | incl --- Gi2/8 10.60.4.181 --- 10.60.123.175 11 0000 0000 355K Gi2/8 10.60.83.28 --- 224.10.10.26 11 F9FF 3840 154K Gi2/8 10.60.83.198 --- ... (1 Reply)
Discussion started by: streetfighter2
1 Replies

7. Shell Programming and Scripting

Finding & Moving Oldest File by Parsing/Sorting Date Info in File Names

I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves. Also, the script should only move a file from /exports to... (6 Replies)
Discussion started by: nikosey
6 Replies

8. Shell Programming and Scripting

Parsing text from file

Any ideas? 1)loop through text file 2)extract everything between SOL and EOL 3)output files, for example: 123.txt and 124.txt for the file below So far I have: sed -n "/SOL/,/EOL/{p;/EOL/q;}" file Here is an example of my text file. SOL-123.go something goes here something goes... (0 Replies)
Discussion started by: ndnkyd
0 Replies

9. Shell Programming and Scripting

Text File Parsing

Hey Guys.I am a newbie on Bash Shell Scripting and Perl.And I have a question about file parsing. I have a log file which contains reports about a communication device.I need to take some of the reports from the log file.Its hard to explain the issue.but shortly I can say that, the reports has a... (2 Replies)
Discussion started by: Djlethal
2 Replies

10. UNIX for Advanced & Expert Users

compiling idl file on unix

hi i need to compile idl files to convert them to classes, on Unix platform. Please tell me how to compile these files & which commands are to be used for this purpose. Thanks & Regards (6 Replies)
Discussion started by: rochitsharma
6 Replies
Login or Register to Ask a Question