Unix administration - Remove ascii code from a certain position in file

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > September 2004 > Remove ascii code from a certain position in file





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Remove ascii code from a certain position in file
John

2004-09-03, 7:50 am

I'm very familiar with the tr command and use it a lot when removing
certain characters from files, but my situation today is involving
needing to remove a newline character from a certain area in the
file.... not all newline characters in the entire file.

If I had a 100 line file and wanted to state "ONLY Between lines 35
and 42, remove the newline character", how would I do that? I'm
thinking this would involve sed, but am unsure about the setup.

Thanks.
Stephane CHAZELAS

2004-09-03, 5:52 pm

2004-09-3, 06:40(-07), John:
> I'm very familiar with the tr command and use it a lot when removing
> certain characters from files, but my situation today is involving
> needing to remove a newline character from a certain area in the
> file.... not all newline characters in the entire file.
>
> If I had a 100 line file and wanted to state "ONLY Between lines 35
> and 42, remove the newline character", how would I do that? I'm
> thinking this would involve sed, but am unsure about the setup.


Please don't multi-post, your question was already answered in
comp.unix.questions

--
Stephane
Michael Vilain

2004-09-03, 5:52 pm

In article <933293a5.0409030540.596094c1@posting.google.com>,
pokechoppe@aol.com (John) wrote:

> I'm very familiar with the tr command and use it a lot when removing
> certain characters from files, but my situation today is involving
> needing to remove a newline character from a certain area in the
> file.... not all newline characters in the entire file.
>
> If I had a 100 line file and wanted to state "ONLY Between lines 35
> and 42, remove the newline character", how would I do that? I'm
> thinking this would involve sed, but am unsure about the setup.
>
> Thanks.


In case someone hasn't mentioned this in the other group you posted in
(cross-posting is encouraged in the unix groups), why not write a perl
or awk script to read lines and keep a count. If the count is between
35 and 42, output the line without the trailing "\n" otherwise just
output the line.

just a SMOP (simple matter of programming)...

--
DeeDee, don't press that button! DeeDee! NO! Dee...



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com