Re: Search Problem



pankaj_wolfhunter@xxxxxxxxxxx wrote:

Greetings,
	I have a file as below

LobFile.txt

1|Charles|test.001.0.1313|123|test.001.0.1423
1|Charles|test.001.1313.3415|243|test.001.1423.3423

Here exp.001.0.1313 and others like it, is a file name with exp.001 as
the name of the file
and 0 as the starting and 1313 as the ending byte position.
This file name appears randomly in many places within the main
file(LobFile.txt)
having exp.001 as common name with all.

I know the grep command can give me those lines where this name appears
but then I don't know at which position within the line that word
appears because I need to go to that position in order to fetch and
make some modification to that name.

I just need a way to line by line search the entire file, fetching that
name whenever it appears, making some modifications and moving further.


I hope I made myself clear. Any help will be appreciated.


It's not really clear, but start with this:

awk -F\| '/exp.001/{for (i=1;i<=NF;i++) if ($i ~ /exp.001/) print NR, i, $i}' LobFile.txt

and let us know what needs to be different.

	Ed.
.



Relevant Pages

  • Re: Warning: mysql_fetch_array(): 5 is not a valid MySQL result resource
    ... in while loops condition you are fetching the next row each time ... when it fetch the 3rd row which is the last row and next time tries to ...
    (comp.lang.php)
  • Re: Data objects vs. speed
    ... a better compromise between getting everything and getting just one field is to have more than one fetch method to allow fetching of multiple columns. ... Another might get this plus address and phone info. ... And since this is a business object, I could have a method which fetches outstanding transactions. ...
    (comp.lang.php)
  • Re: ProgressBar and ADO Dataset
    ... I doubt that the intial fetch will have fetched all ... progressbar mechanism you can see it fetching the records and then proceding ... of moving to the OnFetchProgress event to show thw progress to the user. ... You will need to use the OnFetchComplete event. ...
    (borland.public.delphi.database.ado)
  • hermes: deleting mail on server
    ... In fact, the fetch was fine so, the next time I logged on, I marked the ... email for deletion. ... fetching any other mail. ... Would anyone know how to re-set Hermes so that it deletes the email? ...
    (comp.sys.acorn.apps)
  • Search Problem
    ... I just need a way to line by line search the entire file, fetching that ... making some modifications and moving further. ... TIA ... Prev by Date: ...
    (comp.unix.shell)