syntax gives back funny results


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers syntax gives back funny results
# 1  
Old 10-31-2005
MySQL syntax gives back funny results

i do lots of formatting of types/sorts on my laptop and this is probably one of the basic syntax I use

sed '/\<[0-9]*:/G;/\.$/G;' filename | fmt -w 80 > foo

if I add /**.*/;' to the sed command sometimes i am getting the right output some times I get line-errors...
even with basic syntax as I have put above this gives abnormal file output once in a while where I have tried
cat -v ; col -b and fmt -cw which have all worked but never all the time once in a while I can not figure out
why this syntx splits up some lines in the middle of sentences no matter what I try..
any feedback welcome ; thanx in advance moxxx68
Smilie
# 2  
Old 10-31-2005
Do you have any examples you can post? It's a little hard to know what s going on without them ...
# 3  
Old 10-31-2005
Error

i don't have any actual examples I can show:
but its simple ;
sed '/\.$/G;/[0-9]*;G;' filename
will put a new line at end of paragraph and a newline after any time stamp: both are necessary...
and the fmt -w 80
formats the file to an 80 width::
while a line error usually occurs when there is either a control charcter or a new line
character inserted accidently.. what I need is
a usniversal format of this
sed '#s/\(.*\)\s*\n/\1/' filename which will remove newline space characters in most forms of
sed and I have really no idea which sed does what yet so I need a way to implement this command so that all forms of sed recognize the syntax
# 4  
Old 10-31-2005
Apologies I dont think without a specific example I will be able to help.

I'm really not sure how you can differentiate between a carriage return that's supposed to be there and one thats been accidentally placed in there anyway :-( In your example sed script any carriage return will be seen as and end of paragraph.
# 5  
Old 10-31-2005
"thanks for your kind words but i didn't understand a word you said"
mouin
# 6  
Old 11-01-2005
Sorry moxxx68.

You posted an example sed command:

sed '/\.$/G;/[0-9]*;G;' filename

This command adds an extra 'return' character at the end of each paragraph and after each time stamp. This work fine as far as I can tell.

You also said that you sometimes get extra new lines or control charcters inserted accidentally. What do you mean by this? Are these characters in the original files or after you have run the sed command on them?
# 7  
Old 11-01-2005
these are probably typo errors, since I use ed as an editor alot and i find lots
of files with the same recurring error.
moxxx68
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can ctag and cscope support recording search results and displaying the history results ?

Hello , When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
Discussion started by: 915086731
0 Replies

2. UNIX for Dummies Questions & Answers

back up command and syntax

what is the back up command to take back up files and syntax (1 Reply)
Discussion started by: sunilamarnadh
1 Replies

3. What is on Your Mind?

Old, but still funny

Annoyances.org - Upgrading to Wife 1.0 (0 Replies)
Discussion started by: jgt
0 Replies

4. What is on Your Mind?

Very Funny - Had to laugh

Guys, This is funny. http://i28.photobucket.com/albums/c228/jralph2005/bart.png jaysunn (2 Replies)
Discussion started by: jaysunn
2 Replies

5. What is on Your Mind?

Funny Quotes-UNIX

If you people find something funny like these go ahead and post it :) (5 Replies)
Discussion started by: vidyadhar85
5 Replies

6. UNIX Benchmarks

All came back as 'no measured results'

I downloaded bm.zip, unzipped, compiled and run no problem on this SCO OSR 5.0.7, but resulting log shows "no measured results" in all categories. Any ideas? (1 Reply)
Discussion started by: migurus
1 Replies

7. UNIX for Dummies Questions & Answers

Funny but true....

Hallo everybody I am having a shell script called auto_run.sh in that only the first line works. the second line which has sed command is working only at the # prompt. not within the shell script. What could be the reason. *... sed 's/ //g' KTI >abc works in another shell script without the... (6 Replies)
Discussion started by: naushad
6 Replies

8. Solaris

How to use Secure Shell (SSH) to pass results back to invoking machine

Hi, I am running a script from a client machine X which does "SSH" to around 100 other machines in a farm and invokes a local script on each of those machines. Local script localscript.sh on each of those 100 target machines, does some machine specific function like fetch the specific machine's... (1 Reply)
Discussion started by: waavman
1 Replies
Login or Register to Ask a Question