- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- reading specific line no.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2005 01:16 AM
тАО08-18-2005 01:16 AM
I have been posting too many queries lately as I am in crunch time!!!.
Thanks a bunch for helping out.
Even though I have not responded to few of them I have read and applied them and it has worked wonders!!!
I am trying to read specific line nos from a personal log file and make a new "results.txt" file.
However, I am not able to do so and I am not able to figure out the reason.
IPLXXX - perosonal log file
LINE_NO.TXT - Contains the line nos(one in each line e.g
23
34
.
.
.
45
[end]
I wish to read from personal log file )
Results.txt - Should contain the specified lines copied from IPLXXX.log
Here is the script
$ open read_con IPL_ALL_RESULTS_TRAB.LOG
$ open read_line LINE_NO.TXT
$ open/write output []results.txt
$ count =0;
$ LOOP1:
$ read /end_of_file=END read_con linex
$ count = count+1
$! read /end_of_file=END read_line line
$ if count .eq. line then write output linex
$ GOTO LOOP1
$ END:
$ close read_con
$ close output
$ close read_line
$ exit
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2005 01:25 AM
тАО08-18-2005 01:25 AM
Solution$ open read_con IPL_ALL_RESULTS_TRAB.LOG
$ open read_line LINE_NO.TXT
$ open/write output []results.txt
$ count =0;
$ LOOP1:
$ read /end_of_file=END read_con linex
$ count = count+1
$! read /end_of_file=END read_line line
$! =====================================
$! I suppose line is read from file
$! so it's string variable
$! In your example is not defined
$! =====================================
$ if count .eq. f$int(line) -
then write output linex
$ GOTO LOOP1
$ END:
$ close read_con
$ close output
$ close read_line
$ exit
Antonio Vigliotti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2005 01:40 AM
тАО08-18-2005 01:40 AM
Re: reading specific line no.
$ set noon
$ closee/nolog numbers
$ closee/nolog textfile
$ closee/nolog results
$ openn/read/error=bail_out numbers line_no.txt
$ openn/read/error=bail_out textfile ipl_all_results_trab.log
$ copyy/nolog NLA0: results.txt
$ openn/append/error=bail_out results results.txt
$ tcount = 0
$nloop:
$ readd/end_of_file=end_nloop/error=end_nloop numbers counter
$tloop:
$ readd/end_of_file=end_tloop/error=end_tloop textfile textline
$ tcount = tcount + 1
$ if (tcount .ne. counter) then goto tloop
$ if (tcount .eq. counter) then writee/error=bail_out results textline
$end_tloop:
$ goto nloop
$end_nloop:
$ closee/nolog results
$ closee/nolog textfile
$ closee/nolog numbers
$ exitt 1
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2005 01:43 AM
тАО08-18-2005 01:43 AM
Re: reading specific line no.
$bail_out:
should appear just before the $ exitt 1
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2005 02:39 AM
тАО08-18-2005 02:39 AM
Re: reading specific line no.
I'd use perl for this:
$ cre t.tmp
aap
noot
mies
teun
vuur
$ cre l.tmp
3
5
$ perl -e "open L,shift @ARGV;while (
$ type r.tmp
mies
vuur
$
This first reads the line number file and set an associative array element to 1 for each number found.
Next it loops through the rest of the input and prints if the array element for the current line number ($.) is true.
Done.
The line numbers need not be sorted.
If they are sorted and you must use DCL then check this out:
$ closee/nolog numbers
$ closee/nolog textfile
$ closee/nolog results
$ create r.tmp
$ open numbers l.tmp
$ open textfile t.tmp
$ open/append results r.tmp
$ tcount = 0
$
$number_loop:
$ readd/end=done numbers counter
$loop:
$ readd/end=done textfile textline
$ tcount = tcount + 1
$ if (tcount .lt. counter) then goto loop
$ write results textline
$ goto number_loop
$
$done:
$ closee/nolog results
$ closee/nolog textfile
$ closee/nolog numbers
$ exitt 1
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2005 02:42 AM
тАО08-18-2005 02:42 AM
Re: reading specific line no.
btw... not exactly what you want, but it 'looks' close and is cute (in my sick mind):
$ editt/edt/com=l.tmp t.tmp
3 mies
5 vuur
5 vuur
*
sorry, couldn't resist.
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2005 07:31 AM
тАО08-18-2005 07:31 AM
Re: reading specific line no.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2005 04:59 PM
тАО08-18-2005 04:59 PM
Re: reading specific line no.
$ SEARCH file ""/SKIP=22/LIMIT=1
will display line 23
A fairly expensive method to do what you want is therefore:
$ OPEN/WRITE log IPLXXX.LOG
then use
$ SEARCH file ""/SKIP=line-1/LIMIT=1/OUT=log
Probably not a really practical way to do what you want, but worth pointing out some of the less obvious uses for the new features of SEARCH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2005 08:57 AM
тАО08-25-2005 08:57 AM
Re: reading specific line no.
I will keep the use of search in mind. I believe search normally does work in V7.3-2 (the way you have shown) unless there is something specifically different in V8.2 (from earlier versions of search )that you are trying to show here.