I have a file containing about 5 million rows, in the file there are some records which has extra delimiter at random position. (we dont know the positions), now we have to Count the delimeter from each row and if the count of delimeter is not matching then I want to delete those rows from the file.
What is the most efficient way of doing it. rather how can I do it.
the actual file file has 105 column whith delimeter as open bracket.
Many thanks for the reply,
however by using below command I am able to take out unwated rows in another file , but I want those rows shoud get deleted from main file. any help:confused:
I'm assuming the perl command was truncated in your post, but that it is something like was suggested earlier. If so, then You'll need to move (mv) the output file onto the original file in order to 'replace' the original file with the changes.
You could move the outfile straight over the original file, but it is my experience that having a backup copy of the original file can be a life saver (especially while testing the command).