Assuming that the path of the file to investigate is stored on variable file, the naive approach to test, whether it is a candidate for deletion, would be (in, say, bash or zsh)
Alternatively, you could also write in this particular case
or
The problem is how you want to treat files which have some content, but no terminating newline, and files which are completely empty. For them, *wc -l* would report zero. Depending on whether or not you want to delete them too, you would have to adapt the condition accordingly.
Last edited by rovf; 03-22-2017 at 05:09 AM..
Reason: Improving explanation
Hello Gurus,
I am new to this forum and I have a BASIC knowlege in UNIX commands. I have a data file which contains 1 billion records, how to find 5678th row and put this rows into a new file? Can anybody please give the command how to do this? (3 Replies)
Hi,
I am creating a script to do a find and replace single/multiple lines in a file with any number of lines.
I have written a logic in a script that reads a reference file say "findrep" and populates two variables $FIND and $REPLACE
print $FIND gives
Hi How r $u
Rahul()
Note:... (0 Replies)
Dear sir
I am having a file x.lst having
abcd
andother file y.lst having
efgh
I should get report file having the result in a single row as
abcdefgh
pls help (3 Replies)
Can somebody help me in solving this..
Input data is like
0 A
1 B
2 C
3 D
0 A1
1 B1
2 C1
3 D1
0 A2
1 B2
2 C2
3 D2
Output should be like
A B C D
A1 B1 C1 D1
A2 B2 C2 D2 (7 Replies)
Hi Friends,
I have a single column data like below.
1
2
3
4
5
I need the output like below.
0
1
2
3
4
where each row (including first row) subtracting from first row and the result should print below like the way shown in output file.
Thanks
Sid (11 Replies)
Hi,
Is there a way to find all the files from a specific location and then zip them into a single file, even if they are in multiple directories? (3 Replies)
i have below list of files in a directory.
/root/admin/files/file1.txt
/root/admin/files/file2.txt
/root/admin/files/file3.txt
/root/admin/files/pattern.txt
/root/admin/files/server.txt
i need combine the above text files in the below sequence,
file1.txt, pattern.txt,server.txt =>... (8 Replies)
Hi
I have file "emp.txt"like below
Emp Id Name
123 aa
123 bb
223 cc
233 dd
334 ee
Please help me to know that the position of the blank row. (5 Replies)
Hello ,
Can anyone please help me to solve the below -
Input.txt
source table abc
col1 char
col2 number
source table bcd
col1 date
col2 char
output should be 2 files based on the row separator "source table"
abc.txt
col1 char (6 Replies)
Hi ALL,
We have requirement in a file, i have multiple rows.
Example below:
Input file rows
01,1,102319,0,0,70,26,U,1,331,000000113200000011920000001212
01,1,102319,0,1,80,20,U,1,241,00000059420000006021
I need my output file should be as mentioned below. Last field should split for... (4 Replies)