Hi all,
I have a tab-delimited text file of size 10Mb. I am trying to count the number of lines using,
Code:
grep -c . sample.txt
or
Code:
wc -l < sample.txt
or
Code:
awk 'END {print NR}' sample.txt
All these commands shows the count as 1, which means they are reading only the first header line of the file.
Hi Everybody
I want to write a script to count the number of lines in a file that don't ahve any thing on it, the free lines, i try to do it with fgrep "" which means to grep on the spaces but it does not work.
help me please?
I try to count number of lines of a data.txt file and then if number of lines is greater than 1 then email me the file.
I could not find what is wrong with my code, hope you can point out the mistake i made
Code:
#!
Hi.I need to do a script that can receive any number of parameters which are file names and return the number of lines every file has.the output should be like that "The file nameoffile.txt has 5 lines".From what i have done my output is like "The file nameoffile.txt has 5 nameoffiletxt lines".how can I do the output without printing the name of file after the number of lines.
I know of course that
cat logfile.txt | wc -l
120
will tell me the number of lines in a file.
Whereas
tail -f logfile.txt
will show me the new lines that another program writes to logfile.txt.
Is it possible to combine both so that I get a continuous updating line count of logfile.txt with standard text utilities?
I do know about
watch wc -l logfile.txt
but I do not want to re-count th
I have a file with 22 lines. Each line has only 5 different chars, no white space, and each line is 3,278,824 in length.
i want to search a log for a string.
i want to search a log for occurrences of words and i want the result to tell me how many lines in the log contained each word.
if i type a command like this:
Code:
egrep "cat|dog|monkey|bananas|bike" logfile
i would like a response like this:
Code:
cat=3,dog=17,monkey=1,bananas=102,bike=51
the numbers above for each word being searched for denotes the number of line
The following code will split the infile into multiple files. However, I need it to insert the same first 3 lines from the original input file into each splitted file. How do I modify my script below to do so:
Code:
print -n "Enter file name to split?