![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting same exit status for empty and non empty file | mavesum | UNIX for Dummies Questions & Answers | 4 | 12-03-2008 09:59 AM |
| Trying to empty file using > but the file size increasing when next append | firdousamir | UNIX for Dummies Questions & Answers | 4 | 06-23-2008 03:37 AM |
| File is not empty? | lesstjm | Shell Programming and Scripting | 7 | 07-12-2007 10:21 AM |
| empty file in hp-ux | Mizi | UNIX for Advanced & Expert Users | 2 | 08-09-2006 06:29 AM |
| How will you list only the empty lines in a file (using grep) | JosephGerard | UNIX for Dummies Questions & Answers | 1 | 07-21-2005 03:19 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Grep for empty file
I have a program that takes a file in which I use a sed to remove some data that is not needed. If all of the data is removed. I want to grep for that in the file and print that there is no data left in the file. When I use sed, I replace a word with nothing but it still seems to leave a return carriage. Please give me some ideas on how to do this. Thanks!
|
|
||||
|
Quote:
You could also use the stat command: Code:
if [[ $(stat -c %s file) == 1 ]];then echo "kind of empty";fi |
![]() |
| Bookmarks |
| Tags |
| empty, file, grep, sed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|