Re: Single Line replacement in file




"Raveendran Jazzez" <jazzezravi@xxxxxxxxx> schrieb im Newsbeitrag
news:a65c4c849abcc50137362cbcfd7a8936@xxxxxxxxxxxxxxxxx
My need:

code.rb --> out contains my proper output. But i didn't able to
overwrite the same line in file.It means
1. single --> "wordpress.com/tag/<B>jazzez</B>/ - 11k - "
2. out4 --> "wordpress.com/tag/jazzez"

Here i want to replace the first line in hi.txt file 1 to 2.

You can't replace "lines" in a file because file on disk doesn't know about
lines.

You can read one file, filter its content, write into another file, close
first file, close second file, delete first file or rename to backup, rename
second file to first file.
This would be the easiest way.

or

You read complete file into memory, filter there, seek to file start, write
contents from memory, resize.
More dangerous on errors.

or

You replace characters of these tags by spaces directly in the file, may be
possible but needs more repositioning in file.

I also would recommend to analyze the XML-tree instead of simply removing
the tags wherever found.
Use, for example, "rexml" as contained in Ruby 1.8.






.



Relevant Pages

  • Re: sun blade 1000 ith Solaris 10
    ... OpenBoot 4.16.4, 512 MB memory installed, Serial #16454372. ... 0:0>DMMU TLB DATA RAM Access ... 0:0>DMMU TLB TAGS Access ... 0:0>IO-Bridge unit 0 PCI DMA A test ...
    (SunManagers)
  • Re: Widow/Orphan Doesnt Work
    ... If this doesn't fix the problem, quit Word again, trash the new Normal and ... rename OldNormal back to Normal. ... Navigate to your System folder> Preferences> Microsoft folder. ... Go to the Memory pane and try upping Word's Preferred memory ...
    (microsoft.public.mac.office.word)
  • Re: How Do I Re-Rip My Library Without Losing My Tags?
    ... I decided to let Windows Media Player to rename ... could, after ripping again, edit the file names of the ID3 tag backups ... unique identifier based on the Microsoft/AMG database. ... will be different since they are based on tags. ...
    (microsoft.public.windowsmedia.player)
  • Re: Copy a video file to a different computer for playback
    ... If I double click this file in the TIF folder, ... rename the file - remove anything after the bb.wmv part of the ... The last step is to buy one of those 1GB memory sticks for about $10. ... Plug it in to the PC, and drag the renamed WMV file to the memory ...
    (microsoft.public.windowsmedia.player)
  • Re: Renaming MP3 Files
    ... using the Rename and Rearrange features of WMP's Tools:Options:Library pane. ... See http://zachd.com/pss/pss.html for some helpful WMP info. ... WMP11 artist name, album name, track number and track name tags to rename the ...
    (microsoft.public.windowsmedia.player)