From: wayne on
I'm manually formatting a text file and want to replace some
text characters with hard returns using the "find and replace" feature in
a text editor. However, I haven't been able to figure out how to
represent a hard return so that it would work in the "replace"
command box. I've tried openoffice, kwrite, kate, vim, kword, and abiword.
I used to do this easily in Word Perfect but have not had any success
since moving to Linux. Am I missing something or is the ability to "find
and replace" hard returns just not there?

Thanks,
Wayne
Mandriva 2005LE
From: Bit Twister on
On Wed, 05 Oct 2005 08:10:02 GMT, wayne wrote:
> I'm manually formatting a text file and want to replace some
> text characters with hard returns using the "find and replace" feature in
> a text editor. However, I haven't been able to figure out how to
> represent a hard return so that it would work in the "replace"
> command box. I've tried openoffice, kwrite, kate, vim, kword, and abiword.
> I used to do this easily in Word Perfect but have not had any success
> since moving to Linux. Am I missing something or is the ability to "find
> and replace" hard returns just not there?

In the unix/linux world a linefeed is the hard return. In the windows
world it is a carriage return linefeed.

Now if you want to convert files between the two systems you can use
recode.

man recode for extra points.

I have created two aliases to do the work for me. Placing the
following in ~/.bashrc
alias dos2unix='recode ibmpc..lat1' # remove doze's cr
alias unix2dos='recode lat1..ibmpc' # add doze's cr

then, clicking up a new terminal you can test by copying a file for
testing, and flipping the carriage retun in and out.
Example:
cp ~/.bash_login xx
unix2dos xx
diff ~/.bash_login xx
dos2unix xx
diff ~/.bash_login xx

Note seeing the carriage return in the diff results is kinda hard. :)

From: Peter on
wayne wrote:
> I'm manually formatting a text file and want to replace some
> text characters with hard returns using the "find and replace" feature in
> a text editor.

Open the file in Kate, then use Tools > End of Line , then select whether
you want Unix or MS or Mac style, then save the file.

That's assuming you want to replace one style of line end with another.
However, if you want to replace some particular text characters with a hard
return, you could use khexedit which has more powerful find & replace
capability.


HTH

Peter





From: wbarwell on
wayne wrote:

> I'm manually formatting a text file and want to replace some
> text characters with hard returns using the "find and replace"
> feature in a text editor. However, I haven't been able to
> figure out how to represent a hard return so that it would work
> in the "replace" command box. I've tried openoffice, kwrite,
> kate, vim, kword, and abiword. I used to do this easily in Word
> Perfect but have not had any success since moving to Linux. Am
> I missing something or is the ability to "find and replace"
> hard returns just not there?
>
> Thanks,
> Wayne
> Mandriva 2005LE


You'd have to find the character code representing a hard return
and have F&R use that. I am not sure what that hex code would be
nor how to get any of these to replace using a special code like
that.

The usual way people do that would be with sed.

sed -ie 's/xyz/return/' file.txt

Try comp.unix.shell to ask around what the sed character
representing a return would be, or check google for a sed
tutorial.

In sed as above, the xyz character string would be relaced
with the "return" string in the file text.file.

Or if you used * all text files in a directory, or
*.txt all files with extension .txt and so on.



--
The official spokesman of the Foxes said
today that investigation into what happened
to the henhouse may be needed.

Cheerful Charlie
From: Bit Twister on
On Wed, 05 Oct 2005 08:33:22 -0500, wbarwell wrote:

> Try comp.unix.shell to ask around what the sed character
> representing a return would be,

man ascii for code values

 |  Next  |  Last
Pages: 1 2 3 4 5
Prev: Freeze on screensaver
Next: torrent question