03-20-2007
sed '/^[0-9]/!d' filename
or
awk '/^[0-9]/' filename
or
grep '^[0-9]' filename
Output:
u142115@linux2alm:~/aps/aps4/product/den> sed '/^[0-9]/!d' new
10 11 12
13 14 15
16 17 18
19 20 21
u142115@linux2alm:~/aps/aps4/product/den> awk '/^[0-9]/' new
10 11 12
13 14 15
16 17 18
19 20 21
u142115@linux2alm:~/aps/aps4/product/den> grep '^[0-9]' new
10 11 12
13 14 15
16 17 18
19 20 21
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
This is my first post here, so please bear with me!
I have a file coming into a korn shell script, fixed length. Example:
Peter (25 spaces) D (29 spaces) Younan (24 spaces)
Jim (27 spaces) (30 spaces) ... (4 Replies)
Discussion started by: peteroc
4 Replies
2. Shell Programming and Scripting
I have a flat file and need to count no of records in the file less the header and the trailer record.
I would appreciate any and all asistance
Thanks
Hadi Lalani (2 Replies)
Discussion started by: guiguy
2 Replies
3. UNIX for Dummies Questions & Answers
file_in_1:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
21 22 23 24
25 26 27 28
29 30 31 32
file_in_2:
9 10 11 12
21 22 23 24
1 2 3 4
17 18 19 20
file_out: (5 Replies)
Discussion started by: kenneth.mcbride
5 Replies
4. Shell Programming and Scripting
Hi All,
I have two files say file1 and file2.
I want to check the number of records in file1 and if its atleast 2 (i.e., 2 or greater than 2 ) then I have to check records in file2 .If records in file2 is atleast 1 (i.e. if its not empty ) i have to set some conditions .
Could you pls... (3 Replies)
Discussion started by: mavesum
3 Replies
5. UNIX for Dummies Questions & Answers
Hi everyone.
I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this:
ID: 20
Name: X
Age: 19
ID: 21
Name: Z
ID: 22
Email: xxx@yahoo.com
Name: Y
Age: 19
I want to grep records that... (4 Replies)
Discussion started by: Atrisa
4 Replies
6. Shell Programming and Scripting
I have 2 files
"File 1" is delimited by ";" and "File 2" is delimited by "|".
File 1 below (3 record shown):
Doc1;03/01/2012;New York;6 Main Street;Mr. Smith 1;Mr. Jones
Doc2;03/01/2012;Syracuse;876 Broadway;John Davis;Barbara Lull
Doc3;03/01/2012;Buffalo;779 Old Windy Road;Charles... (2 Replies)
Discussion started by: vestport
2 Replies
7. Shell Programming and Scripting
Hi Freinds ,
I have 2 files .
File 1
|nag|HYd|1|Che
|esw|Gun|2|hyd
|pra|bhe|3|hyd
|omu|hei|4|bnsj
|uer|oeri|5|uery
File 2
|nag|HYd|1|Che
|esw|Gun|2|hyd
|uer|oi|3|uery
output : (9 Replies)
Discussion started by: i150371485
9 Replies
8. Shell Programming and Scripting
Hi I am new to shell programming in unix
Please if I can provide help.
I have a file structure of a header record and "N" detail records.
The header record will be the total number of detail records
I need to split the file in 2:
One for the header
Another for all detail records
Could... (1 Reply)
Discussion started by: jamcogar
1 Replies
9. Shell Programming and Scripting
Not sure if this is the correct forum for this question. I have two files. file1.zip, file2
Input:
file1.zip
col1, col2 , col3
a , b , 0:0:0:0:0:c436:9346:d40b
x, y, 0:0:0:0:0:880:39f9:c9a7
m, n , 0:0:0:0:0:80c7:9161:fe00
file2.txt
col1
c4:36:93:46:d4:0b... (1 Reply)
Discussion started by: anil.v
1 Replies
10. UNIX for Beginners Questions & Answers
I have this code with me but the condition is If any of the mandatory columns are null then entire file will be rejected.
LOAD DATA
infile ' ' #specifies the name of a datafile containing data that you want to load
BADFILE ' ' #specifies the name of... (1 Reply)
Discussion started by: raka123
1 Replies
LEARN ABOUT DEBIAN
locale::msgcat
Msgcat(3pm) User Contributed Perl Documentation Msgcat(3pm)
NAME
Locale::Msgcat - Perl extension for blah blah blah
SYNOPSIS
use Locale::Msgcat;
$cat = new Locale::Msgcat;
$rc = $cat->catopen(name, oflag);
$msg = $cat->catgets(set_number, message_number, string);
$rc = $cat->catclose();
DESCRIPTION
The Locale::Msgcat module allows access to the message catalog functions which are available on some systems. A new Locale::Msgcat object
must first be created for each catalog which has to be open at a given time.
The catopen operation opens the catalog whose name is given as argument. The oflag can be either 0 or NL_CAT_LOCALE (usually 1) which is
the recommended value.
The catgets message retrieves message_number for the set_number message set, and if not found returns string.
The catclose function should be used when access to a catalog is not needed anymore.
EXAMPLES
use Locale::Msgcat;
$cat = new Locale::Msgcat;
unless ($cat->catopen("whois.cat", 1)) {
print STDERR "Can't open whois catalog.
";
exit(1);
}
printf "First message, first set : %s
", $cat->catgets(1, 1, "not found");
unless ($cat->catclose()) {
print STDERR "Can't close whois catalog.
";
exit(1);
}
The above example would print the first message from the first message set found in the whois catalog, or if not found it would print "not
found".
AUTHOR
Christophe Wolfhugel, wolf@pasteur.fr
SEE ALSO
catopen(3), catclose(3), catgets(3), perl(1).
perl v5.14.2 1999-11-15 Msgcat(3pm)