LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-17-2001, 03:55 PM   #1
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,014
Blog Entries: 54

Rep: Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764
Insert CRLF's with sed?


Im using DeleGate, the multiprotocol proxy, which supports rudimentary modifications to the traffic stream (similar to using netsed), tru usage of what they call "CFI Script". Now I would like to be able to break up stuff by inserting a lot of CRLF's.

The simplest solution would be to tag a html entity like x (read: ampersand,hashmark,1,2,0,semicolon) on, but ofcourse Wintendo will not allow for lower unicode chars at all, or translate this to "x". FWIW, Ive been able to use Bash (on windoze :-] ) and "tr" to piggyback a \120 or \130 on a stream, so I *know* thats possible, but CFI Script will allow only "sed" usage.

Hope the prev. is clear.
Q: *how* can I tag on a CRLF with sed?

TIA for any pointers!
 
Old 10-17-2001, 04:44 PM   #2
isajera
Senior Member
 
Registered: Jun 2001
Location: San Antonio, TX
Distribution: distro? what's a distro?
Posts: 1,635

Rep: Reputation: 45
ok... i'm not really sure what you're asking here... do you just need help with the sed command? it's going to be something like

sed 's/char/CRLF/g' infile > outfile

where char is what you want to replace with the CRLF's. if you want to add CRLF's without getting rid of the chars (or whatever)

sed 's/char/charCRLF/g' infile > outfile

naturally, of course, the CRLF's will be \n or whatever it is they're supposed to be. CRLF is carriage-return/linefeed... right?
 
Old 10-18-2001, 01:55 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,014
Blog Entries: 54

Original Poster
Rep: Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764
Thnx, Isajera, What I need is a solution with sed to insert these Carriage return/Line feed control chars (think its unicode, right?) that *stick*. Using "\n" can't work IMO, because "\n" doesnt mean nothing to Wintendo when the stream gets there, and somehow I never could get the backslash escaped, how many escapechars I put in front of it :-]

So it's not the way *how* to insert chars, but *what* chars to insert :-]

*Can* sed even insert control chars so a Wintendo box can recognize em???
 
Old 10-18-2001, 08:35 PM   #4
isajera
Senior Member
 
Registered: Jun 2001
Location: San Antonio, TX
Distribution: distro? what's a distro?
Posts: 1,635

Rep: Reputation: 45
if memory serves correctly, ^M is the windows equiv of \n.

i'd test it out first, tho.
 
Old 10-19-2001, 03:22 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,014
Blog Entries: 54

Original Poster
Rep: Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764
Thnx again for your ideas Isajera, Ill try that out.
 
Old 11-20-2006, 05:50 AM   #6
lolmaker
LQ Newbie
 
Registered: Nov 2006
Posts: 12

Rep: Reputation: 0
^m













. . . . .
 
Old 11-22-2006, 07:46 AM   #7
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,284

Rep: Reputation: 172Reputation: 172
dos2unix unix2dos any good ??
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert string with sed greg108 Programming 7 02-18-2005 01:11 PM
insert output of sed into a variable hwouters Linux - General 3 11-06-2004 07:54 PM
insert a symbol with sed tonton Programming 5 08-31-2004 11:33 AM
sed command to insert tab? iluvatar Linux - Software 4 06-29-2004 01:56 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM


All times are GMT -5. The time now is 08:57 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration