The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-27-2008
kolesunil kolesunil is offline
Registered User
  
 

Join Date: May 2008
Posts: 8
Validation of character separated lines in a file

Hi,

I have a file with "|" separated fields. If the line doesn't contain n "|" (say 2), then put this line in a file called invalid_file.txt. If it does put this row in a file called valid_file.txt.

For e.g. A file contain following rows:
Code:
Hi|Hello
How|Are|You
Hello
then
invalid_file.txt should contain:
Code:
How|Are|You
Hello
valid_file.txt should contain:
Code:
Hi|Hello
Any help is highly appreciated.


Thanks,
SK

Last edited by Yogesh Sawant; 05-27-2008 at 08:08 AM.. Reason: added code tags