sed remove expression from output I'm watching


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers sed remove expression from output I'm watching
# 8  
Old 04-22-2012
20 is the ASCII Hexadecimal for the Space character. What software wrote this file? If it was Microsoft HTML it would be %20 not #20 .
What software are you using to view this file?

Can you post a definitive view of a couple of records with the unix od command (preferably with output in hexadecimal)? Command syntax varies according to your Operating System (not posted). Use man od .

Last edited by methyl; 04-22-2012 at 07:11 PM..
# 9  
Old 04-22-2012
I think what is happening is that the sed that is printing matching records knows that stdout isn't a tty and is buffering the output. The number of records that match and are printed aren't enough to fill and flush the buffer, so it appears as nothing is being output from the second sed. By reversing the sed commands, the volume through the first was large enough to flush the buffer and the output from the second sed isn't buffered because stdout is the tty.

This is probably very close to what you tried that worked, just a wee bit better because there is only one sed process:

Code:
tail -f log-file | sed -n "s/#20//g; /$*/p"

Not as efficient as the replacement is done to records that aren't printed, but stdout of the sed is a tty and output shouldn't be buffered.

Last edited by agama; 04-22-2012 at 08:42 PM.. Reason: better explaination
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

I am learning regular expression in sed,Please help me understand the use curly bracket in sed,

I am learning SED and just following the shell scripting book, i have trouble understanding the grep and sed statement, Question : 1 __________ /opt/oracle/work/antony>cat teledir.txt jai sharma 25853670 chanchal singhvi 9831545629 anil aggarwal 9830263298 shyam saksena 23217847 lalit... (7 Replies)
Discussion started by: Antony Ankrose
7 Replies

2. Shell Programming and Scripting

How does this sed expression to remove non-alpha characters work?

Hello! I know that this expression gets rid of non-alphanumeric characters: sed 's///g' and I understand that it is replacing them with nothing - hence the '//'-, but I don't understand how it's doing it. It seems it's finding strings that begin with alphanumeric and replacing them with... (2 Replies)
Discussion started by: bgnersoon2be#1
2 Replies

3. Shell Programming and Scripting

sed returns error "sed: -e expression #1, char 18: unterminated `s' command"

Hello All, I have something like below LDC100/rel/prod/libinactrl.a LAA2000/rel/prod/libinactrl.a I want to remove till first forward slash that is outputshould be as below rel/prod/libinactrl.a rel/prod/libinactrl.a How can I do that ??? (8 Replies)
Discussion started by: anand.shah
8 Replies

4. Shell Programming and Scripting

sed & remove duplicates on output

sed -e '1d' -e 's/^\(]\{2\}\)-\(]\{3\}\)-\(]\{4\}\).*/"0000020\1\200\3"\,/g' abc.txt This script returns many duplicates due to the duplciates in the .txt file. i.e. ... "000002012149000060", "000002012149000064", "000002012149000064", "000002012149000064", "000002012149000064",... (9 Replies)
Discussion started by: Daniel Gate
9 Replies

5. Shell Programming and Scripting

perl regular expression to remove the special characters

I had a string in perl script as below. Tue Augáá7 03:54:12 2012 Now I need to replace the special character with space. After removing the special chaacters Tue Aug 7 03:54:12 2012 Could anyone please help me here for writing the regular expression? Thanks in advance.. Regards, GS (1 Reply)
Discussion started by: giridhar276
1 Replies

6. UNIX for Advanced & Expert Users

sed: -e expression #1, char 0: no previous regular expression

Hello All, I'm trying to extract the lines between two consecutive elements of an array from a file. My array looks like: problem_arr=(PRS111 PRS213 PRS234) j=0 while } ] do k=`expr $j + 1` sed -n "/${problem_arr}/,/${problem_arr}/p" problemid.txt ---some operation goes... (11 Replies)
Discussion started by: InduInduIndu
11 Replies

7. Shell Programming and Scripting

Need perl regular expression to remove the comment

I need a perl substitution to remove only the comment in the line . That line may have '#' with in double quotes .I used the following , s/(^.*\".+?#.+?\".+?)(#.*)/$1/g It works for , print " not a comment # not a comment " . "not a comment # not a comment" ; # It is a comment ... (3 Replies)
Discussion started by: karthigayan
3 Replies

8. Shell Programming and Scripting

watching for a file

Hi dears, The script should watch for a file in particular directory. If the file not come into the directory even after 30 seconds from execution of the script, then script should exit saying “file not arrived” Any help ?? (4 Replies)
Discussion started by: Gopal_Engg
4 Replies

9. Shell Programming and Scripting

Need to remove improperly formatted fortran output line from files, tried sed

I have been trying to remove some improperly formatted lines of output from fortran code I have been using. The problem is that I have some singularities in the math for some points that causes an incorrectly large value to be reported that exceeds the normal formating set in the code resulting in... (2 Replies)
Discussion started by: gillesc_mac
2 Replies
Login or Register to Ask a Question