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 > Shell Programming and Scripting
.
google unix.com



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
deleting lines by number cary530 UNIX for Dummies Questions & Answers 9 03-30-2009 02:09 PM
Deleting lines in a file reachsamir Shell Programming and Scripting 2 05-29-2007 11:17 AM
Deleting last 2 lines from the file. videsh77 Shell Programming and Scripting 4 04-06-2007 01:14 PM
deleting lines ajnabi Shell Programming and Scripting 8 05-02-2003 11:50 AM
deleting lines supercbw High Level Programming 1 05-06-2002 12:53 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-24-2006
satnamx satnamx is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 34
Red face deleting lines using awk-best way?

Hi all....I'm using awk to validate a csv file, but now I've been told to delete any invalid lines from the file.. Im not sure what the best way to do this is?

Would it be to create a temp file say "csv_temp.tmp" file and print all the valid records to that temp file. Then delete the old file "csv_file.csv" and rename the temp file to "csv_file.csv"?

is this an efficient way of doing this? any code snippets of kind of file manipulation would be greatly appreciated?

Kind Regards

Satnam
  #2 (permalink)  
Old 04-24-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
If this is real data, then consider writing the data into two files: good.csv bad.csv
Then when someone asks 'What did you exclude?' - bad.csv has your answers.
  #3 (permalink)  
Old 04-24-2006
satnamx satnamx is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 34
Smile cheers..

Hi jim, thanks for the feedback always useful stuff!

cheers
  #4 (permalink)  
Old 08-29-2007
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 188
can i know how i can delete a particular record from a 1 million record file using awk?
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0