Sponsored Content
Top Forums UNIX for Advanced & Expert Users query display number lines or records present in file only numeric value -without filename Post 302540914 by itkamaraj on Friday 22nd of July 2011 03:16:09 AM
Old 07-22-2011
try this

Code:
 
wc -l < file

otherwise, use awk, cut,...etc...

---------- Post updated at 12:44 PM ---------- Previous update was at 12:31 PM ----------

Code:
 
grep -c . file

---------- Post updated at 12:44 PM ---------- Previous update was at 12:44 PM ----------

Code:
 
awk '{i++;} END{print i}' file

---------- Post updated at 12:46 PM ---------- Previous update was at 12:44 PM ----------

Code:
 
perl -lane '$i++;END{print $i}'  file

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

display lines after a particular line number

I have a file that has 1k lines and i want to print all the lines after 900th line. an 2)I want to move files f1 ,f2,f3,f4 to p1,p2,p3,p4 Please give me the commands. Thanx in adv. (6 Replies)
Discussion started by: rajashekar.y
6 Replies

2. Shell Programming and Scripting

how to display records of file

dear all, supose there is file called myfile.txt and in this file there are two records.. like this way:- myfile.txt records 1 A:B:C:D:E records 2 B:C:A:F:G I have to find A and display output as "in myfile.txt in record1 A has feild 1 and in myfile.txt in record2 A... (2 Replies)
Discussion started by: mishra_sk_in
2 Replies

3. Shell Programming and Scripting

To find the count of records from tables present inside a file.

hi gurus, I am having a file containing a list of tables.i want to find the count of records inside thes tables. for this i have to connect into database and i have to put the count for all the tables inside another file i used the following loop once all the tablenames are inside the file. ... (1 Reply)
Discussion started by: navojit dutta
1 Replies

4. Solaris

WARNING: filename <not present on Read Only file system>+pkgadd error

Hi when trying to install the package initially that i have created on to the target host, i am getting error as below for all the files/directories during pkgadd. WARNING: filename <not present on Read Only file system> ........... ........... and so on. When i do the second attempt to... (1 Reply)
Discussion started by: kiran.zamre
1 Replies

5. Shell Programming and Scripting

How to only display lines where a field has the highest number?

Hello Wondering if anybody can advise me how I can sort the below file so it only displays lines with the latest versions of an object? As you'll see some of the scripts listed in my file have more than one version number (version number is after the file extension). E.g. cdm_bri.pkb has... (2 Replies)
Discussion started by: Glyn_Mo
2 Replies

6. UNIX for Dummies Questions & Answers

To get the lines that are not present in file

Hi I have got two files File1: Row1 Row2 Row3 Row4 File2: Row3 Row4 Now my requirement is search each and every line of file1 in file2 and if the record do not exist in file2 then write that to an output file. Output file should be as below Row1 Row2 (4 Replies)
Discussion started by: sbhuvana20
4 Replies

7. UNIX Desktop Questions & Answers

How to display only the lines from a file which do not contain a given number

a. How do I display the content of the file containing what Ive merged using a filter which would display only the lines of the file which don't contain number, for example 3 or 6. (3 Replies)
Discussion started by: herberwz
3 Replies

8. Shell Programming and Scripting

Need unix commands to delete records from one file if the same record present in another file...

Need unix commands to delete records from one file if the same record present in another file... just like join ... if the record present in both files.. delete from first file or delete the particular record and write the unmatched records to new file.. tried with grep and while... (6 Replies)
Discussion started by: msathees
6 Replies

9. Shell Programming and Scripting

Display the Filename and Size of a File

Hello, all! Working in a Bourne shell. What command would list the filename and size of a file if the size of the file had to be bigger than $a and smaller than $b? Output (if $a is 10 bytes and $b is 50 bytes):test1.txt 15 test2.txt 30 test3.txt 50 Thanks, Ann :p (3 Replies)
Discussion started by: LowlyIntern
3 Replies

10. Shell Programming and Scripting

grep exact string from files and write to filename when string present in file

I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Discussion started by: JC_1
4 Replies
host(1) 						      General Commands Manual							   host(1)

NAME
host - DNS lookup utility SYNOPSIS
class] ndots] number] type] wait] name [server] DESCRIPTION
is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa. With no options or operands, prints an annotated usage summary. Options Use only the IPv4 query transport. Use only the IPv6 query transport. Equivalent to using Attempt to display the records for zone name from all the listed authoritative name servers for that zone. The list of name servers is defined by the records that are found for the zone. Make a DNS query of class class. This can be used to look up class resource records. The values for class are: The Internet class (default). The MIT Chaosnet class. The MIT Athena Hesiod class. The class values are case-insensitive. Generate verbose output. Now equivalent to the option. is provided for backwards compatibility. In previous versions, it switched on debugging traces. Use the IP6.INT domain, as defined in RFC 1886, to perform reverse lookups of IPv6 addresses. The default is to use IP6.ARPA. Select list mode. performs a zone transfer for zone name. Transfer the zone, printing out the and address records If is combined with all records will be printed. Set the number of dots that have to be in name for it to be considered absolute. The default value is defined using the statement in or is if no statement is present. Names with fewer dots are interpreted as relative names and will be searched for in the domains listed in the or directive in Set the number of UDP retries for a lookup. number indicates how many times will repeat a query that does not get answered. The default number of retries is 1. If number is negative or zero, the number of retries is set to 1. Make nonrecursive queries. Setting this option clears the RD (recursion desired) bit in the query which makes. This should mean that the name server receiving the query will not attempt to resolve the name operand. This option enables to mimic the behavior of a name server by making nonrecursive queries and expecting to receive answers to those queries that are usually referrals to other name servers. Use a TCP connection when querying the name server. TCP is automatically selected for queries that require it, such as zone transfer requests. By default uses UDP when making queries. Select the query type. type can be any recognized query type: and so on. For potential values, see the command in nslookup(1) and the discussion in named.conf(4). The type values are case-insensitive. When the option is omitted, automatically selects an appropriate query type. By default, it looks for records, but if the option is given, queries are made for records. If the operand is an IPv4 or IPv6 address, queries for records. For a query type of you can specify the starting serial number by appending an equals sign followed by the starting serial number (for example, Generate verbose output. Set the time to wait for a reply to wait seconds. If wait is less than 1, the wait interval is set to 1. Effectively wait forever for a reply. The time to wait for a response is set to the number of seconds given by the hardware's maximum value for an integer quantity. Operands name The domain name that is to be looked up. It can also be an IPv4 or IPv6 address, in which case will, by default, perform a reverse lookup for that address. server The name or IP address of the name server that should query. The default is the server or servers listed in EXAMPLES
Using a host name: Using an IP address: AUTHOR
was developed by the Internet Systems Consortium (ISC). FILES
SEE ALSO
dig(1), nslookup(1), named(1M), named.conf(4), resolver(4). Requests for Comments (RFC): 1886, available online at available online at available from the Internet Systems Consortium at BIND 9.3 host(1)
All times are GMT -4. The time now is 10:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy