Hey 244an, thanks for the reply...
Thanks for the insight..!
Sorry I'm not exactly sure what your asking?
Are you saying that I "shouldn't" be able to remove these character sequences with the REGEX,
because "^[" is NOT literally a "^" or a "[", but "literally" an "ESC"...?
If that's what your saying, then I'm not sure why it would be working then..? Maybe it's the way I'm
writing the output to the file...
EDIT:
Ok... I see what your saying now. I just checked the output file in VI and you were right about the "^[", if
I scroll through the file it skips over the "^[" as if it were one character. I see what you mean by it being
weird that it actually works.!?
Maybe it has something to do with the "cat -v" command. The "-v" or aka "--show-nonprinting" will use ^
and M- notation, except for LFD and TAB. I'm assuming this probably is the reason why it's working..?
Here is my code for reading the file and removing those sequences:
Now from the command line if I run "cat myOutputFile.txt" I get:
Quote:
DATE: Monday 08-20-2012 TIME: 10:15 AM REMOTE_HOST: myHost-vm (192.168.5.101)
Getting the Status of the NRPE Daemon:
- The NRPE Daemon is Running with PID=2532
Then running "cat -v myOutputFile.txt":
Quote:
^[[1mDATE:^[[0m Monday 08-20-2012
^[[1mTIME:^[[0m 10:15 AM
^[[1mREMOTE_HOST:^[[0m myHost-vm (192.168.5.101)
Getting the Status of the NRPE Daemon:
- The NRPE Daemon is Running with ^[[1mPID=2532^[[0m
Soo I'm not exactly sure why it's working, but I just know i'm glad it does lol...
But anyway thanks again for your reply...
I am running Solaris 10. Can someone help me interpret the output from "echo $-"?
Interactively, the output is:
ism
From within a cron job, the output is:
xh
Why are they different? Can someone point me to the appropriate documentation?
Thanks,
J (1 Reply)
Hi,
I've modified the syslogd source to include a thread that will keep track of a timer(or a timer thread). My intention is to check the file size of /var/log/messages in every one minute & if the size is more than 128KB, do a echo " " > /var/log/messages, so that the file size will be set... (7 Replies)
So in my shell i execute:
{ while true; do echo string; sleep 1; done } | read line This waits one second and returns.
But
{ while true; do /bin/echo string; sleep 1; done } | read line continues to run, and doesn't stop until i kill it explicitly.
I have tried this in bash as well as zsh,... (2 Replies)
echo `echo ` doesn't echoes anything. And it's logic. But
echo `echo `echo ` ` does echoes "echo". What's the logic of it? the `echo `echo ` inside of the whole (first) echo, echoes nothing, so the first echo have to echo nothing but echoes "echo"
(too much echoing :P):o (2 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi Folks,
As per the subject, the following command is not working as expected.
echo $variable | mail -s "subject" "xxx@xxx.com"
Could anyone figure it out whats wrong with this. I am using AIX box.
Regards, (2 Replies)
I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here.
I have following script (called out_to_streams.csh):
#!/bin/tcsh -f
echo Redirected to STDOUT > /dev/stdout
echo Redirected to... (2 Replies)
Hello friends/'unix experts',
i have a file as below
cat sample.txt
satish
/rakesh/
sandhya
/sandeep/
i have to replace /rakesh/ with rakesh, how can i do it with sed, i tried below code but its throwing errors
sed -e 's/'"\(/rakesh/)\"'/\1rakesh/g' sample.txt
... (1 Reply)
So far what i've got is
egrep '^(\\)\*$'No luck.
I've searched the web and not much luck. I know about the escape character \ but its confusing to figure out how to use it to match a backslash and use it to escape the asterisk also. Any ides? Thanks! (8 Replies)
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)