Re: Any Idea (..Continuing)




<pankaj_wolfhunter@xxxxxxxxxxx> wrote in message news:1133440473.049591.3980@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> we have two files:
>
> File 1
>
>
> 000130|ascii|exp.001.0.1313/
> 000130|script|exp.001.1313.1817/
> 000140|ascii|db2exp.001.3130.1316/
>
>
> File 2
> Some large data
>
> The end part of File1 i.e exp.001.0.1313, exp.001.1313.1817 etc
> specifies the byte position for the respective data in File2.
> Means that in the first line of File1 (i.e exp.001.0.1313) 0 specifies
> the starting byte position and 1313 specifies the ending byte position
> in File 2 and so goes on with all the lines.
>
> I want to write a script which takes File 1 into loop, takes the first
> line, then takes the respective byte positions.
> Extract out that much data out of File 2 and replaces that data with
> the last word of the line just fetched from File 1.
> Similarly for the next line and so on.
>
> I hope I have made myself clear. Any Ideas?
>

I do not have time to do this for you but my first thought is
to use dd (with bs=1, count and seek set to appropriate values)
and to do it in two stages.

Step 1: parse the data and output write a script that uses dd.
Step 2: run the script output by stage 1.

My second thought is to use perl rather than dd, and read
the whole of file 2 so you can treat it as an array which
should make seeking and replacement easier. But still to do
this in two stages as above. (Or use C and memory-map file2:
it is conceptually the same thing.) And maybe in this case
the two stages could be two different perl functions within
the same program: again, conceptually it is much the same.

--
John.


.



Relevant Pages

  • Re: Changing user attribute in AD script driving me batty
    ... This script modifies an attribute of all the accounts in a specified ... /value: specifies new value. ... Verbose "Connecting to root of domain" ... For Each oADObject in oContainer ...
    (microsoft.public.scripting.wsh)
  • Re: startx gdm
    ... a script, or something. ... ("-H" specified for the sudo process to change the home directory to YourUserName's home directory; "-i" specifies the process to simulate an initial login, that is, to run the program specified in /etc/password for this user.) ... # Note that on most Debian systems tty7 is used by the X Window System, ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)
  • Changing user attribute in AD script driving me batty
    ... I have a bunch of scripts from an MS toolkit “Windows administrators ... This script modifies an attribute of all the accounts in a specified active ... /value: specifies new value. ... For Each oADObject in oContainer ...
    (microsoft.public.scripting.wsh)
  • RE: Changing user attribute in AD script driving me batty
    ... error An invalid dn sytacx has been specified ... This script modifies an attribute of all the accounts in a specified active ... /value: specifies new value. ...
    (microsoft.public.scripting.wsh)
  • Re: strictly posix shell mode ?
    ... What's the best way to confirm that a script is POSIX. ... specifies both the shell behavior and also (and actually more ...
    (comp.unix.shell)