---------- Post updated at 03:04 PM ---------- Previous update was at 02:43 PM ----------
Are you running this script in windows machine ?
---------- Post updated at 03:17 PM ---------- Previous update was at 03:04 PM ----------
$ARGV[0]||='/home/user01/UnprocessedData.out'; --> check any file is passed as argument, if not then take the file /home/user01/UnprocessedData.out $linenum=0; --> initalize the value to 0 open OR,$ARGV[0]; --> FileHandler OR to open the file while (<OR>) { --> loop the file upto the last line next if /^\s*$/; --> skip the next line code if the line is blank $linenum++; --> once if condition fails, it will increase the variable value (it means, it is not blank line) } --> end of while loop print "$linenum\n"; -->print the linenum variable value. close OR; --> close the fileHandler
I have a directory of files, I can show the number of lines in each file and order them from lowest to highest with:
wc -l *|sort
15263 Image.txt
16401 reference.txt
40459 richtexteditor.txt
How can I also print the number of unique lines in each file?
15263 1401 Image.txt
16401... (15 Replies)
Hello Friends,
Can anyone help me for the below requirement.
I am having a file called Input.txt.
My requirement is first check the count that is wc -l input.txt
If the result of the wc -l Input.txt is less than 10 then don't split the Input.txt file. Where as if Input.txt >= 10 the split... (12 Replies)
Hi all,
I tried to use the paste command to paste two files with different number of lines.
e.g.
file1
A 1
B 1
C 2
D 2
file2
A 2
B 3
C 4
D 4
E 4 (2 Replies)
I'm kinda stuck on this one, I have 7 files with 30.000 lines/file like this
050 0.023 0.504336
050 0.024 0.529521
050 0.025 0.538908
050 0.026 0.537035
I want to find the mean line by line of the third column from the files named like this:
Stat-f-1.dat .... Stat-f-7.dat
Stat-s-1.dat... (8 Replies)
how to count the total number of lines of all the files under a directory using perl script..
I mean if I have 10 files under a directory then I want to count the total number of lines of all the 10 files contain. Please help me in writing a perl script on this. (5 Replies)
Hello, I'm trying to create a BASH file that can read all the files in my working directory and tell me how many words and lines are in that file. I wrote the following code:
FILES="*"
for f in "$FILES"
do
echo -e `wc -l -w $f`
done
My issue is that my file is outputting in one... (4 Replies)
I am getting a few gzip files into a folder by doing ftp to another server. Once I get them I move them to another location .But before that I need to make sure each gzip is not more than 5000 lines and split it up . The files I get are anywhere from 500 lines to 10000 lines in them and is in gzip... (4 Replies)
Can you help me please?
I know that
wc -l *.txt gives you the number of lines in each file. But how can i count the files that have over n lines? (4 Replies)
Hello every 1
Happy new year ;)
I have a problem when i've tried to write my shell scripts..
this what i've done
Actually, i would like to restore the files that i have deleted by line number for example :
1 : filename1
2: filename2
3: filename3
then i can restore them by... (8 Replies)