LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 01-18-2008, 01:28 AM   #1
UltraSoul
Member
 
Registered: Dec 2004
Location: Japan
Distribution: REDHAT9.0, Mandrake10.1
Posts: 404

Rep: Reputation: 31
sed questions


Hi,

I have so many lines such as follows. It seems that I got Japanese character crash in my solaris10. How to fix it if possible?

"<2004ǯ04��13�� (��) 21��46ʬ05�� JST"


I want to use sed to take all lines out and change it to another one, But I do not know how to do that? any idea?
 
Old 01-19-2008, 09:01 AM   #2
crisostomo_enrico
Member
 
Registered: Dec 2005
Location: Madrid
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547

Rep: Reputation: 36
Maybe I'm missing something or maybe you don't give sufficient details...

Quote:
I have so many lines such as follows. It seems that I got Japanese character crash in my solaris10. How to fix it if possible?
If you're suffering an information loss, it may be impossible to restore the file at the original state. By the way, are you sure about what happened? What's a "Japanese character crash"? A file in a locale whose support is not installed in your system may appear unreadable, but that does not mean your file is broken.

Quote:
I want to use sed to take all lines out and change it to another one, But I do not know how to do that? any idea?
Take all lines? With sed you can for example look for a regular expression to match some lines, but if you're changing all of them, why don't you replace the entire file? I don't understand how you'll be filtering lines.
 
Old 01-19-2008, 09:13 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
And...where are these lines? e.g. in a file?

Do you get stuff like this when opening any file?

If you simply open a terminal an enter "ls -l", is the output normal?
 
Old 01-22-2008, 04:32 AM   #4
greeneagle
Member
 
Registered: Dec 2004
Location: Dublin Ireland via Cobh, Limerick.
Distribution: RedHat, Suse, Ubuntu.
Posts: 33

Rep: Reputation: 16
What would you like to do exactly?

Just looking for ascii info try:
$ strings <file>

You might like to read
$man tr

This is really handy illustration of tr AND if you're poking at binary files often your terminal gets messed up:
$ alias reset='echo "X[mX(BX)0OX[?5lX7X[rX8" | tr "XO" "\033\017"'

tr is used so the whole command can be in ascii (and emailed/skyped/cut&pasted without problems)
and tr translates X to \033 (ESC) (and O to \017 (SI))


from man tr:

Example 1 Creating a list of words

The following example creates a list of all words in file1,
one per line in file2, where a word is taken to be a maximal
string of letters.

tr -cs "[:alpha:]" "[\n*]" <file1 >file2
 
  


Reply



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
BASH array / sed questions ParaDoX667 Programming 8 04-04-2007 05:12 AM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 11:36 AM
sed questions slack66 Linux - Newbie 6 04-29-2006 10:24 AM
[sed] "Advanced" sed question(s) G00fy Programming 2 03-20-2006 12:34 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 08:32 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration