Sponsored Content
Full Discussion: count lines of file
Top Forums Shell Programming and Scripting count lines of file Post 302120410 by Shell_Life on Wednesday 6th of June 2007 10:44:59 AM
Old 06-06-2007
Panknil,
The only way to know how many lines a file has is to count
line by line, which is what "wc -l" does.
Anything else will use the same logic.
If it is taking too long, there is nothing else you can do.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count number of lines in Binary file

Hi Friends Please help me out to count number of lines in binary file. It gives some wrong(less) using wc -l. Is there any other way to count lines of binary file. Thanks. (3 Replies)
Discussion started by: vanand420
3 Replies

2. Programming

to count the number of commented lines in a file

can someone guide me how to have a C pgm to count the number of commented lines? (3 Replies)
Discussion started by: naan
3 Replies

3. Shell Programming and Scripting

Count lines between two patterns inside a file

Hi, Im doing a script to find the number of lines included inside a file newly. These lines are in between #ifdef FLAG1 and #else or #endif or #else and #endif. I tried like this, awk '/#ifdef Flag1/,/#e/{print}' aa.c | wc -l awk '/#ifndef Flag1/,/#endif/{print}' aa.c | awk... (6 Replies)
Discussion started by: priyadarshini
6 Replies

4. UNIX for Dummies Questions & Answers

Count of Number of Lines in a File

Dear Members, I want to count the number of lines in a file; for that i am using the following command : FILE_LINE_COUNT=`wc -l $INT_IN/$RAW_FILE_NAME` if i do an echo on FILE_LINE_COUNT then i get 241 /home/data/testfile.txt I don't want the directory path to be displayed. Variable... (1 Reply)
Discussion started by: sandeep_1105
1 Replies

5. Shell Programming and Scripting

Count the number of lines in a file with one condition

Hi Everyone, 1.txt Mon 08 Feb 2010 12:30:44 AM MYT;1265560244;e164:0000116047275464;T;Central;0; Mon 08 Feb 2010 12:30:46 AM MYT;1265560246;e164:0000116047275464;T;Central;0; Mon 08 Feb 2010 12:30:48 AM MYT;1265560248;e164:0000116047275464;T;Central;0; Mon 08 Feb 2010 12:30:50 AM... (1 Reply)
Discussion started by: jimmy_y
1 Replies

6. Shell Programming and Scripting

Trying to do a count on multiple lines in a file

Guys I am having a problem with being able to do a count of entries in a file. What I am trying to get a count of the total number of members that are listed in the files. So I need to pull the number of the lines after members. I tried using sed but it only seems to count the first... (7 Replies)
Discussion started by: scottzx7rr
7 Replies

7. Solaris

WC -l does not count all the lines in a file? HELP

I have a file that I need to merge with another like file. Normally I remove the trailer reocrd and merge the file and update the trailer record of the second file. I did a WC -l on the first file before I removed the trailer record, and again afterwards. The count came back the same. I opened the... (6 Replies)
Discussion started by: Harleyrci
6 Replies

8. Shell Programming and Scripting

Help with script to read lines from file and count values

Hi, I need some help with a script I'm trying to write. I have a log file containing references to a number of different webservices. I wish to write a script that will list the webservices with a count as to how many times they appear in the log. An example of the log file content: ... (2 Replies)
Discussion started by: gman2010
2 Replies

9. Shell Programming and Scripting

count lines in file to variable

I have a text file in which you need to identify the number of lines that looks like this: awk '{x + +} END {print x}' filename The problem is that I do not know how this data to any variable in which then need to continue to work in a cycle for .. do not know someone help? Sorry for my... (4 Replies)
Discussion started by: gizmo16
4 Replies

10. Shell Programming and Scripting

If file exists count lines

Hello, Currently I have: FILE=/home/file.txt if ; then echo "File $FILE exists" else echo "File $FILE does not exist" fi exit I would like to make it such that if the file *does* exist, it performs a wc -l count of the file and then if the count is greater than 3 performs... (3 Replies)
Discussion started by: holyearth
3 Replies
MOUNT.CONF(8)						    BSD System Manager's Manual 					     MOUNT.CONF(8)

NAME
mount.conf -- root file system mount configuration file SYNOPSIS
/.mount.conf DESCRIPTION
During the bootup process, the FreeBSD kernel will try to mount the root file system using the logic in the vfs_mountroot() function in src/sys/kern/vfs_mountroot.c. The root mount logic can be described as follows: 1. The kernel will synthesize in memory a config file with default directives for mounting the root file system. The logic for this is in vfs_mountroot_conf0(). 2. The kernel will first mount devfs(8) as the root file system. 3. Next, the kernel will parse the in-memory config file created in step 1 and try to mount the actual root file system. See FILE FORMAT for the format of the config file. 4. When the actual root file system is mounted, devfs will be re-mounted on the /dev directory. 5. If a /.mount.conf file does not exist in the root file system which was just mounted, the root mount logic stops here. 6. If a /.mount.conf file exists in the root file system which was just mounted, this file will be parsed, and the kernel will use this new config file to try to re-mount the root file system. See FILE FORMAT for the format of the config file. 7. If the new root file system has a /.mount directory, the old root file system will be re-mounted on /.mount. 8. The root mount logic will go back to step 4. The root mount logic is recursive, and step 8 will be repeated as long as each new root file system which is mounted has a /.mount.conf file. FILE FORMAT
The kernel parses each line in .mount.conf and then tries to perform the action specified on that line as soon as it is parsed. # A line beginning with a # is a comment and is ignored. {FS}:{MOUNTPOINT} {OPTIONS} The kernel will try to mount this in an operation equivalent to: mount -t {FS} -o {OPTIONS} {MOUNTPOINT} / If this is successfully mounted, further lines in .mount.conf are ignored. If all lines in .mount.conf have been processed and no root file system has been successfully mounted, then the action specified by .onfail is performed. .ask When the kernel processes this line, a mountroot> command-line prompt is displayed. At this prompt, the operator can enter the the root mount. .md file Create a memory backed md(4) virtual disk, using file as the backing store. .onfail [panic|reboot|retry|continue] If after parsing all the lines in .mount.conf the kernel is unable to mount a root file system, the .onfail directive tells the kernel what action to perform. .timeout N Before trying to mount a root file system, if the root mount device does not exist, wait at most N seconds for the device to appear before trying to mount it. If .timeout is not specified, the default timeout is 3 seconds. EXAMPLES
The following example .mount.conf will direct the kernel to try mounting the root file system first as an ISO CD9660 file system on /dev/cd0, then if that does not work, as an ISO CD9660 file system on /dev/acd0, and then if that does not work, as a UFS file system on /dev/ada0s1a. If that does not work, a mountroot> command-line prompt will be displayed where the operator can manually enter the root file system to mount. Finally if that does not work, the kernel will panic. .onfail panic .timeout 3 cd9660:/dev/cd0 ro .timeout 0 cd9660:/dev/acd0 ro .timeout 3 ufs:/dev/ada0s1a .ask The following example .mount.conf will direct the kernel to create a md(4) memory disk attached to the file /data/OS-1.0.iso and then mount the ISO CD9660 file system on the md device which was just created. The last line is a comment which is ignored. .timeout 3 .md /data/OS-1.0.iso cd9600:/dev/md# ro # Can also use cd9660:/dev/md0 ro The following example .mount.conf will direct the kernel to create a md(4) memory disk attached to the file /data/base.ufs.uzip and then mount the UFS file system on the md uzip device which was just created by the geom_uzip(4) driver. .md /data/base.ufs.uzip ufs:/dev/md#.uzip ro # Can also use ufs:/dev/md0.uzip ro The following example .mount.conf will direct the kernel to do a unionfs mount on a directory /jail/freebsd-8-stable which has a chroot(2) environment. .timeout 3 unionfs:/jail/freebsd-8-stable NOTES
For each root file system which is mounted, a /dev directory must exist so that the root mount logic can properly re-mount devfs(8). If this directory does not exist, the system may hang during the bootup process. SEE ALSO
nmount(2), md(4), boot.config(5), fstab(5), boot(8), loader(8), mount(8) HISTORY
The mount.conf file first appeared in FreeBSD 9.0. AUTHORS
The root mount logic in the FreeBSD kernel which parses /.mount.conf was written by Marcel Moolenaar <marcel@FreeBSD.org>. This man page was written by Craig Rodrigues <rodrigc@FreeBSD.org>. BSD
July 7, 2013 BSD
All times are GMT -4. The time now is 09:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy