01-31-2008
I think the second line should be printed if it contains a digit, not the every second line
eg
cat filename
one two three:
1 2 3
four five six
4 5 6
the o/p should be
one two three:
1 2 3
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Maybe this question is out there, but I searched and didnt see it.
To print my files I use
more filename | lpr -Pprinter
I would like to print my scripts with line numbers.
How do I do this? (2 Replies)
Discussion started by: MizzGail
2 Replies
2. Shell Programming and Scripting
I've scoured the forum and found similar problems but I can't seem to adapt them to help me with my cause.
This is a two-part question.
I have a multi line file generated by ps | -ef
I need to print out a certain type of pattern. The pattern is part static and part dynamic.
It is a... (3 Replies)
Discussion started by: FK_Daemon
3 Replies
3. Shell Programming and Scripting
Hello,
any trick to print line number and last two characters of each line ? (4 Replies)
Discussion started by: Bashar
4 Replies
4. Shell Programming and Scripting
Hello friends,
Only very recently i started learning sed command...an i found that sed is faster in finding the patterns than some of my scripts that uses grep to check the patten inside a file using line by line search method which is time consuming.
The below script... (4 Replies)
Discussion started by: frozensmilz
4 Replies
5. Shell Programming and Scripting
Hello,
I am testing some data to get line number at cursor position 9 and found some problem, the code is below.Assume we got 3 attribute. At second attribute, there are some data(eg.A41/A6) missing like at the fourth and six line
11006 A41 1888
11006 ... (7 Replies)
Discussion started by: davidkhan
7 Replies
6. Programming
#include <iostream>
int main() {
int x=0;
int y=1000;
while(x<1000) {
x++, y--;
system("clear");
printf("\n%d\n%d", x,y);
fflush(stdout);
}
return 0;
}
Without clearing the screen every time, how can i print 'x' and 'y' in the same spot? (2 Replies)
Discussion started by: cbreiny
2 Replies
7. Shell Programming and Scripting
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
8. UNIX for Dummies Questions & Answers
Help,
I have a text file which looks like
disco 5674536
3456 jambo
disco 453678
4578 jambo
I would like to have an output which looks like below
disco 3456 disco 4578 (4 Replies)
Discussion started by: Indra2011
4 Replies
9. Shell Programming and Scripting
Dear All,
fileName: therm.txt
nc3h7o2h 7/27/98 thermc 3h 8o 2 0g 300.000 5000.000 1390.000 41
1.47017550e+01 1.71731699e-02-5.91205329e-06 9.21842570e-10-5.36438880e-14 2
-2.99988556e+04-4.93387892e+01 2.34710908e+00 4.34517484e-02-2.65357553e-05 3
... (7 Replies)
Discussion started by: linuxUser_
7 Replies
10. Shell Programming and Scripting
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
LEARN ABOUT OPENSOLARIS
readfile
readfile(1F) FMLI Commands readfile(1F)
NAME
readfile, longline - reads file, gets longest line
SYNOPSIS
readfile filename
longline [filename]
DESCRIPTION
The readfile function reads filename and copies it to stdout. No translation of NEWLINE is done. It keeps track of the longest line it
reads and if there is a subsequent call to longline, the length of that line, including the NEWLINE character, is returned.
The longline function returns the length, including the NEWLINE character, of the longest line in filename. If filename is not specified,
it uses the file named in the last call to readfile.
EXAMPLES
Example 1 Typical use of readfile and longline
Here is a typical use of readfile and longline in a text frame definition file:
.
.
.
text="`readfile myfile`"
columns=`longline`
.
.
.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
cat(1), attributes(5)
DIAGNOSTICS
If filename does not exist, readfile will return FALSE (that is, the expression will have an error return).
longline returns 0 if a readfile has not previously been issued.
NOTES
More than one descriptor can call readfile in the same frame definition file. In text frames, if one of those calls is made from the text
descriptor, then a subsequent use of longline will always get the longest line of the file read by the readfile associated with the text
descriptor, even if it was not the most recent use of readfile.
SunOS 5.11 5 Jul 1990 readfile(1F)