Sponsored Content
Full Discussion: printing a line of a file
Top Forums UNIX for Dummies Questions & Answers printing a line of a file Post 588 by Neo on Friday 15th of December 2000 04:13:18 PM
Old 12-15-2000
Yes, you can do it in any scripting language. Use the one which is the most comfortable for you. KSH will work as well all shell scripting languages. I recommended PERL because of its superior file I/O and pattern matching functions. However, if you don't know PERL, it is certainly possible with KSH.

Feel free to post your final script. It should not be too long, based on your posts. Happy to review.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

printing an empty line in a file (perl)

I know this must be really easy, but i can't get it to work I've got a perl script, with a file. I want to print an empty line, and the following doesn't seem to work: print nameoffile "\n" thanks for your help!! (3 Replies)
Discussion started by: kfad
3 Replies

2. UNIX for Dummies Questions & Answers

Printing a Line from a file

I have a log file with several lines as follows: Aug 30 06:35:08 trnwvltfit1 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but responded to ping I am using the date of the line to determine which lines to print. However, I am only trying to print the parts of the line that are NOT... (4 Replies)
Discussion started by: Nysif Steve
4 Replies

3. Shell Programming and Scripting

Re-write first line of a file before printing

Morning All, Quite a simple one this, I hope. What I want to do is to re-write the first line of a file before it's sent to print. The line will be blank initially, and I want to insert some text. The operation can either be done on the file itself (modifying the file on disk), OR in a... (2 Replies)
Discussion started by: alexop
2 Replies

4. UNIX for Advanced & Expert Users

printing specific line from a file.

The below line gives the perfect output when I mention the record number and file name as hardcoded. awk 'NR==3{print}' samp2.txt But when I pass the record num and file name as variable, it doesn't give any output. row_num=3;file2=samp2.txt;awk 'NR==$row_num {print}' $file2 Can you... (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

5. Shell Programming and Scripting

printing each line in a file X times

This is probably simple but I would like to print every line in a file 5 times like this: awk 'NR' mens_csv.tab Dub Tank 53%Hemp/42%Cotton/5%Lycra Jersey Dark Green 0 $22.50 Dub Tank 53%Hemp/42%Cotton/5%Lycra Jersey Indigo Blue 0 $22.50 --------------- Dub... (4 Replies)
Discussion started by: Autumn Tree
4 Replies

6. Shell Programming and Scripting

Printing a particular line to a file

Hi, I have a file in which the entries are of the following type: 5649 S 1 0412 S 0 0423 S 1 0020 N 0 0020 N 0 1022 S 1 1022 S 1 I need to print the whole line which is having 0 in the third column into a different file Thanks... (6 Replies)
Discussion started by: swasid
6 Replies

7. UNIX and Linux Applications

Printing a line in a file

Hi I have a file having multiple lines. I want to print a particular line. How can I do this? Thanks in advance Ananth (5 Replies)
Discussion started by: Ananthdoss
5 Replies

8. Homework & Coursework Questions

Lex: analyzing a C file and printing out identifiers and line numbers they're found on

Florida State University, Tallahassee, FL USA, Dr. Whalley, COP4342 1. The problem statement, all variables and given/known data: Create a lex specification file that reads a C source program that ignores keywords and collects all identifiers (regular variable names) and also displays the line... (3 Replies)
Discussion started by: D2K
3 Replies

9. Shell Programming and Scripting

Awk: Comparing arguments with in line values of file and printing the result

I need to develop a script where I will take two date arguments as parameter date1 and date2 which will in format YYYYMM. Below is the input file say sample.txt. sample.txt will have certain blocks starting with P1. Each block will have a value 118,1:TIMESTAMP. I need to compare the... (7 Replies)
Discussion started by: garvit184
7 Replies

10. Shell Programming and Scripting

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

My file (the output of an experiment) starts off looking like this, _____________________________________________________________ Subjects incorporated to date: 001 Data file started on machine PKSHS260-05CP ********************************************************************** Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies
PERLVOS(1)						 Perl Programmers Reference Guide						PERLVOS(1)

NAME
perlvos - Perl for Stratus OpenVOS SYNOPSIS
This file contains notes for building perl on the Stratus OpenVOS operating system. Perl is a scripting or macro language that is popular on many systems. See perlbook for a number of good books on Perl. These are instructions for building Perl from source. This version of Perl requires the dynamic linking support that is found in OpenVOS Release 17.1 and thus is not supported on OpenVOS Release 17.0 or earlier releases. If you are running VOS Release 14.4.1 or later, you can obtain a pre-compiled, supported copy of perl by purchasing the GNU Tools product from Stratus Technologies. BUILDING PERL FOR OPENVOS
To build perl from its source code on the Stratus V Series platform you must have OpenVOS Release 17.1.0 or later, GNU Tools Release 3.5 or later, and the C/POSIX Runtime Libraries. Follow the normal instructions for building perl; e.g, enter bash, run the Configure script, then use "gmake" to build perl. INSTALLING PERL IN OPENVOS
1. After you have built perl using the Configure script, ensure that you have modify and default write permission to ">system>ported" and all subdirectories. Then type gmake install 2. While there are currently no architecture-specific extensions or modules distributed with perl, the following directories can be used to hold such files (replace the string VERSION by the appropriate version number): >system>ported>lib>perl5>VERSION>i786 3. Site-specific perl extensions and modules can be installed in one of two places. Put architecture-independent files into: >system>ported>lib>perl5>site_perl>VERSION Put site-specific architecture-dependent files into one of the following directories: >system>ported>lib>perl5>site_perl>VERSION>i786 4. You can examine the @INC variable from within a perl program to see the order in which Perl searches these directories. USING PERL IN OPENVOS
Restrictions of Perl on OpenVOS This port of Perl version 5 prefers Unix-style, slash-separated pathnames over OpenVOS-style greater-than-separated pathnames. OpenVOS- style pathnames should work in most contexts, but if you have trouble, replace all greater-than characters by slash characters. Because the slash character is used as a pathname delimiter, Perl cannot process OpenVOS pathnames containing a slash character in a directory or file name; these must be renamed. This port of Perl also uses Unix-epoch date values internally. As long as you are dealing with ASCII character string representations of dates, this should not be an issue. The supported epoch is January 1, 1980 to January 17, 2038. See the file pod/perlport.pod for more information about the OpenVOS port of Perl. TEST STATUS
A number of the perl self-tests fails for various reasons; generally these are minor and due to subtle differences between common POSIX- based environments and the OpenVOS POSIX environment. Ensure that you conduct sufficient testing of your code to guarantee that it works properly in the OpenVOS environment. SUPPORT STATUS
I'm offering this port "as is". You can ask me questions, but I can't guarantee I'll be able to answer them. There are some excellent books available on the Perl language; consult a book seller. If you want a supported version of perl for OpenVOS, purchase the OpenVOS GNU Tools product from Stratus Technologies, along with a support contract (or from anyone else who will sell you support). AUTHOR
Paul Green (Paul.Green@stratus.com) LAST UPDATE
February 28, 2013 perl v5.18.2 2013-11-04 PERLVOS(1)
All times are GMT -4. The time now is 09:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy