Sponsored Content
Top Forums Shell Programming and Scripting Function to add escape character before specified character Post 302881507 by kurumi on Monday 30th of December 2013 03:00:59 AM
Old 12-30-2013
Code:
# echo "abcd fkaj&dsdsd" | ruby -e 's=gets; puts s.gsub(/([& ;])\1*/,"\\\\\\1")'
abcd\ fkaj\&dsdsd

This User Gave Thanks to kurumi For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

possible to escape the \ character in sed?

is it possible to escape the \ character in sed? right now I'm trying to replace all occurances of \ with \\ sed \"s|test|test_replacement|g\" file1 > output; #this works fine sed \"s|\\|\\\|g\" file1 > output; #this generates the following error: sed: -e expression #1, char 17:... (1 Reply)
Discussion started by: gammaman
1 Replies

2. Shell Programming and Scripting

Escape character in vi?

I want to replace a string which contains "/" in vi but what is the escape character for forward slash? e.g. I have a text file with the contents below and I want to replace "/Top/Sub/Sub1" with "ABC". /Top/Sub/Sub1 The replace command I am using is ... (4 Replies)
Discussion started by: stevefox
4 Replies

3. Shell Programming and Scripting

awk / escape character

Hi I'm trying to split a dir listing eg /home/foo1/foo2 I'm using ksh I've tried dir=/home/foo1/foo2 splitit=`echo $dir | awk -F '\/' '{print $1}'` echo $splitit nothing is output! I have checked the escape character. The only one I have found is \ BTW `pwd` | awk -F \/... (8 Replies)
Discussion started by: OFFSIHR
8 Replies

4. Shell Programming and Scripting

Escape character

Hi , I want to change space to ' in my script. I tried doing this, sed 's/ /\'/g' filename but i could not get it. can some one help me please. Thanks, Deepak (4 Replies)
Discussion started by: deepakpv
4 Replies

5. Shell Programming and Scripting

escape character in tcsh

Hello, I wanted to display command with echo like this in tcsh. output should be "//'test.test1.test2'" (" at both ends also required in output) Please help me. (1 Reply)
Discussion started by: balareddy
1 Replies

6. Shell Programming and Scripting

Escape character in sed

Hello experts I am trying to write a shell script which will add ' ' to a unix variable and then pass it to oracle for inserting to a table. I am running the script as root and I have to do a su -c . The problem is the character ' is not recognised inside sed even after adding escape... (1 Reply)
Discussion started by: pvedaa
1 Replies

7. UNIX for Advanced & Expert Users

if 4th and 5th character of sting -ge 45 then add 1 to 3rd character

I want to know how to, given a string like W87151WR71C, if the 4th and 5th character (in this case 15) are greater than 45, then to add 1 to the 3rd character (in this case 7) and assign the revised string the variable name MODSTRING. Thanks in advance. This is ultimately to grab info from... (6 Replies)
Discussion started by: glev2005
6 Replies

8. Shell Programming and Scripting

Problem with using a sed to add escape character \ before $ and ' symbols

Hi all, I've got a problem with sed. Want to use it to add escape character \ before $ and ' symbols so condition='1'$some will become condition=\'1\'\$some echo "condition='1'$some" | sed 's/\($\)/\\\1/g' is not working properly. Can somebody help me with this please? Regards,... (7 Replies)
Discussion started by: johny_be_good
7 Replies

9. Shell Programming and Scripting

sed - with escape character

i have string as below str=".<date>" in which i need to replace < with /< , when i tried with sed , got the output. --> echo $str | sed 's/</\\</g' .\<date> when i tried to assign it to a variable , i am not getting the same --> a=`echo $str | sed 's/</\\</g'` ; echo $a... (4 Replies)
Discussion started by: expert
4 Replies

10. Shell Programming and Scripting

Escape special character

Hi, How to use * in call to pl/sql block from shell script? The line "select * from" is causing all files and directiores to show up in email notification but if I give all column names then it works, Please let me know how to use '*' instead of giving all column names, in other wirds how to... (2 Replies)
Discussion started by: sandy162
2 Replies
WARPIMAGEMULTITRANSFORM(1)					   User Commands					WARPIMAGEMULTITRANSFORM(1)

NAME
WarpImageMultiTransform - part of ANTS registration suite DESCRIPTION
Usage: ./WarpImageMultiTransform ImageDimension moving_image output_image -R reference_image --use-NN SeriesOfTransformations--(See Below) SeriesOfTransformations --- ./WarpImageMultiTransform can apply, via concatenation, an unlimited number of transformations to your data . Thus, SeriesOfTransformations may be an Affine transform followed by a warp another affine and then another warp. Inverse affine transformations are invoked by calling -i MyAffine.txt InverseWarps are invoked by passing the InverseWarp.nii.gz filename (see below for a note about this). Example 1: Mapping a warped image into the reference_image domain by applying abcdWarpxvec.nii.gz/abcdWarpyvec.nii.gz/abcd- Warpzvec.nii.gz and then abcdAffine.txt ./WarpImageMultiTransform 3 moving_image output_image -R reference_image abcdWarp.nii.gz abcdAffine.txt Example 2: To map the fixed/reference_image warped into the moving_image domain by applying the inversion of abcdAffine.txt and then abcdInverseWarpxvec.nii.gz/abcdInverseWarpyvec.nii.gz/abcdInverseWarpzvec.nii.gz . ./WarpImageMultiTransform 3 reference_image output_image -R moving_image -i abcdAffine.txt abcdInverseWarp.nii.gz Note that the inverse maps (Ex. 2) are passed to this program in the reverse order of the forward maps (Ex. 1). This makes sense, geometrically ... see ANTS.pdf for visualization of this syntax. Compulsory arguments: ImageDimension: 2 or 3 (for 2 or 3 Dimensional registration) moving_image: the image to apply the transformation to output_image: the resulting image Optional arguments: -R: reference_image space that you wish to warp INTO. --tightest-bounding-box: Computes the tightest bounding box using all the affine transformations. It will be overrided by -R refer- ence_image if given. --reslice-by-header: equivalient to -i -mh, or -fh -i -mh if used together with -R. It uses the orientation matrix and origin encoded in the image file header. It can be used together with -R. This is typically not used together with any other transforms. --use-NN: Use Nearest Neighbor Interpolation. --use-BSpline: Use 3rd order B-Spline Interpolation. -i: will use the inversion of the following affine transform. Other Example Usages: Reslice the image: WarpImageMultiTransform 3 Imov.nii.gz Iout.nii.gz --tightest-bounding-box --reslice-by-header Reslice the image to a reference image: WarpImageMultiTransform 3 Imov.nii.gz Iout.nii.gz -R Iref.nii.gz --tightest-bounding-box --reslice-by-header Important Notes: Prefixname "abcd" without any extension will use ".nii.gz" by default The abcdWarp and abcdInverseWarp do not exist. They are formed on the basis of abcd(Inverse)Warpxvec/yvec/zvec.nii.gz when calling ./WarpImageMultiTransform, yet you have to use them as if they exist. WarpImageMultiTransform 1.9 May 2012 WARPIMAGEMULTITRANSFORM(1)
All times are GMT -4. The time now is 04:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy