07-10-2009
Remove escape characters from string
Hello all,
I have a string var which contains formatting characters at the end, it is a string with EScape sequences at the end of it.
How can I remove them so that I only keep the 'real' text?
I tried :
var1=${var1%%\033[0m}
does not seem to do the job ....
Please help
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
Consider i have a directory /tmp/test and inside this directory i have the following files:
1.svf.tmp
2.svf.tmp
3.svf.tmp
How can i remove the last four characters of every file in irder for the directory to be as:
1.svf
2.svf
3.svf
I use the following command but id doesn't... (6 Replies)
Discussion started by: chriss_58
6 Replies
2. Shell Programming and Scripting
Hi there,
I'd like to write a script that removes any set of character from any string. The first argument would be the string, the second argument would be the characters to remove. For example:
$ myscript "My name's Santiago. What's yours?" "atu"
My nme's Snigo. Wh's yors?
I wrote the... (11 Replies)
Discussion started by: chebarbudo
11 Replies
3. Shell Programming and Scripting
Hi All,
I have a text file containing two fields, the first field holds the website name and the second one holds the rest of the URL (Request part). My requirement is to split the request part based on the characters "=" and "&". The process should also consider the URL escape characters, for... (4 Replies)
Discussion started by: john2022
4 Replies
4. UNIX for Dummies Questions & Answers
I am running a script where one of the variables (the month and year) is input at the command line. What I would like to do is chop off the last few characters of that string to create a new variable, while maintaining the old one.
The script is run like this:
./pull_station_v4.csh KYWST... (3 Replies)
Discussion started by: TheSMan5
3 Replies
5. Shell Programming and Scripting
Hi.
for the following line:
Var1=${Array}
now Array has text as "{hello there}"
how do I remove the {} brackets before assigning the string to Var1?
Thanks. (3 Replies)
Discussion started by: shadow_boi
3 Replies
6. Shell Programming and Scripting
I'm tring to remove the last 4 characters from strings in a file i.e.
cat /tmp/test
iwishicouldremovethis
icouldremovethos
so i would end up with the last 4 characters from each of the above i.e.
this
thos
I thought of using cut -c ... but I'm not sure how many characters will... (7 Replies)
Discussion started by: josslate
7 Replies
7. Shell Programming and Scripting
Hi
I am new in shell scripting and i want to manipulate a string.
I have a string tha looks like: /home/nteath/file.txt
I want to remove everything until the last "/" , to keep only the filename.
e.g. /home/nteath/file.txt
output: file.txt
Thanks (2 Replies)
Discussion started by: nteath
2 Replies
8. Shell Programming and Scripting
Hello Folks..
I need your help ..
here the example of my problem..i know its easy..i don't all the commands in unix to do this especiallly sed...here my string..
dwc2_dfg_ajja_dfhhj_vw_dec2_dfgh_dwq
desired output is..
dwc2_dfg_ajja_dfhhj
it's a simple task with tail... (5 Replies)
Discussion started by: victor369
5 Replies
9. Shell Programming and Scripting
Hi All,
I have a variable like
AVAIL="\
BACK:bkpstg:testdb3.iad.expertcity.com:backtest|\
#AUTH:authstg:testdb3.iad.expertcity.com:authiapd|\
TEST:authstg:testdb3.iad.expertcity.com:authiapd|\
"
What I want to do here is that If a find # before any entry, remove the entire string... (5 Replies)
Discussion started by: engineermayur
5 Replies
10. Shell Programming and Scripting
Hi,
I have string like this ="Lookup Procedure"
But i want the output like this Lookup Procedure
=," should be removed.
Please suggest me the solution.
Regards,
Madhuri (2 Replies)
Discussion started by: srimadhuri
2 Replies
LEARN ABOUT CENTOS
stapdyn
STAPDYN(8) System Manager's Manual STAPDYN(8)
NAME
stapdyn - systemtap dyninst runtime
SYNOPSIS
stapdyn [ OPTIONS ] MODULE [ MODULE-OPTIONS ]
DESCRIPTION
The stapdyn program is the dyninst back-end of the Systemtap tool. It expects a shared library produced by the front-end stap tool, when
run with --dyninst.
Splitting the systemtap tool into a front-end and a back-end allows a user to compile a systemtap script on a development machine that has
the debugging information (need to compile the script) and then transfer the resulting shared objevct to a production machine that doesn't
have any development tools or debugging information installed.
Please refer to stappaths(7) for the version number, or run rpm -q systemtap (fedora/red hat) apt-get -v systemtap (ubuntu)
OPTIONS
The stapdyn program supports the following options. Any other option prints a list of supported options.
-v Verbose mode.
-V Print version number and exit.
-w Suppress warnings from the script.
-c CMD Command CMD will be run and the stapdyn program will exit when CMD does. The '_stp_target' variable will contain the pid for CMD.
-x PID The '_stp_target' variable will be set to PID.
-o FILE
Send output to FILE. If the module uses bulk mode, the output will be in percpu files FILE_x(FILE_cpux in background and bulk mode)
where 'x' is the cpu number. This supports strftime(3) formats for FILE.
-C WHEN
Control coloring of error messages. WHEN must be either "never", "always", or "auto" (i.e. enable only if at a terminal). If the op-
tion is missing, then "auto" is assumed. Colors can be modified using the SYSTEMTAP_COLORS environment variable. See the stap(1)
manual page for more information on syntax and behaviour.
var1=val
Sets the value of global variable var1 to val. Global variables contained within a script are treated as options and can be set from
the stapdyn command line.
ARGUMENTS
MODULE is either a module path or a module name. If it is a module name, the module will be looked for in the following directory (where
'VERSION' is the output of "uname -r"):
/lib/modules/VERSION/systemtap
$ stap --dyninst -p4 -m mod1 -e 'global var1="foo"; probe begin{printf("%s
", var1); exit()}'
Running this with an additional module argument:
$ stapdyn mod1.so var1="HelloWorld"
HelloWorld
Spaces and exclamation marks currently cannot be passed into global variables this way.
EXAMPLES
See the stapex(3stap) manual page for a collection of sample scripts.
Here is a very basic example of how to use stapdyn. First, use stap to compile a script. The stap program will report the pathname to the
resulting module.
$ stap --dyninst -p4 -e 'probe begin { printf("Hello World!
"); exit() }'
/home/user/.systemtap/cache/85/stap_8553d83f78c_265.so
Run stapdyn with the pathname to the module as an argument.
$ stapdyn /home/user/.systemtap/cache/85/stap_8553d83f78c_265.so
Hello World!
SAFETY AND SECURITY
Systemtap, in DynInst mode, is a developer tool, and runs completely unprivileged. The Linux kernel will only permit one's own processes
to be accessed, which is enforced by the ptrace(2) system call. See the stap(1) manual page for additional information on safety and secu-
rity.
SEE ALSO
stap(1), stapprobes(3stap), stap-server(8), staprun(8), stapex(3stap)
BUGS
Use the Bugzilla link of the project web page or our mailing list. http://sourceware.org/systemtap/, <systemtap@sourceware.org>.
STAPDYN(8)