Operating System - Linux
1745786 Members
3855 Online
108722 Solutions
New Discussion юеВ

Re: sed command giving an error

 
srnagu
Occasional Advisor

sed command giving an error

Hi,

Will somebody please help me ?
When I execute this ....
paste -s -d"^m" swagent.log | sed '{s/\"\./\"\.\n/g}' > swagent.new
I get following error.
sed: Function {s/\"\./\"\.\n/g} cannot be parsed.

 

P.S. This thread has been moved from  HP-UX>General to HP-UX > languages. -HP Forum Moderator

23 REPLIES 23
James R. Ferguson
Acclaimed Contributor

Re: sed command giving an error

HI:

Drop the curly braces:

# sed 's/\"\./\"\.\n/g'

That said, what are you attempting to do? On HP-UX there is 'ux2dos' and 'dos2ux' to convert between Unix and DOS (Windows) line terminations. See the manpages for 'dos2ux'.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: sed command giving an error

As JRF says, drop the {}. But if you really really want them, I think you need a ";" before the "}".

You also seem to have a "\" before the double quote. This isn't needed and may mess you up.

You might explain what you are doing. You seem to be adding CRs. Then you seem to be adding newlines but not after the CRs, after '".'.
srnagu
Occasional Advisor

Re: sed command giving an error

Hi,

Thanks for quick response.

When I tried this without {}

This is the error

paste -s -d"^m" swagent.log | sed 's/\"\./\"\.\N/g' > swagent.new

Error which I got :--


sed: Memory allocation failed.


James R. Ferguson
Acclaimed Contributor

Re: sed command giving an error

Hi (again):

> sed: Memory allocation failed.

Again, exactly what is your objective?

Your command creates one HUGH single-line file that is longer than your 'sed' buffers can tolerate.

Regards!

...JRF...
srnagu
Occasional Advisor

Re: sed command giving an error

By mistake in HP UX, Ihave changed the owner and gid of all the files.
After that I did run swverify \*
It generated a log file.
Please find attached doc.

I want to merge 1st and 2nd line, 3rd and 4th line ...........

That is why I'm using sed
James R. Ferguson
Acclaimed Contributor

Re: sed command giving an error

Hi (again):

> By mistake in HP UX, I have changed the owner and gid of all the files. After that I did run swverify \* ...I want to merge 1st and 2nd line, 3rd and 4th line ...

If you are trying to correct the permissions and ownership, you can use 'swverify' to do this!

# swverify -F \*

Regards!

...JRF...
srnagu
Occasional Advisor

Re: sed command giving an error

Thx,
I was not knowing this.

Will this fix errors?
How can I fix these errors ?
Dennis Handly
Acclaimed Contributor

Re: sed command giving an error

>I want to merge 1st and 2nd line, 3rd and 4th line

If you want to do this, use awk:
awk '
{
getline second
print $0, second
}' swagent.log

You can use sed but it's much harder to understand/remember:
sed -e 'N; s/\n/ /' swagent.log
James R. Ferguson
Acclaimed Contributor

Re: sed command giving an error

Hi (again):

From the 'swverify(1M)' manpages:

"-F Runs vendor-specific fix scripts to correct and report problems on installed software. The fix script can create missind directories, correct file modifications (mode, owner, group, major, and minor), and recreate symbolic links."

Regards!

...JRF...