12-12-2006
sed converting / to \/
Hi all,
I am using sed for converting a string of type
/abc/def/gh by
\/abc\/def\/gh
[trainee@LINUX ~]$ edu="/home/abc/dec"
When I echo that variable and pass it to sed ,it works fine...
[trainee@LINUX ~]$ echo $edu|sed 's/\//\\\//g'
\/home\/abc\/dec
But When I try to store in a variable , it shows the following error
[trainee@LINUX ~]$ ued=`echo $edu|sed 's/\//\\\//g'`
sed: -e expression #1, char 9: unknown option to `s'
HELP BLEAZ
Last edited by sakthi.abdullah; 12-12-2006 at 09:23 AM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
When I create filesystems in AIX i often get confused(using smit)
When you specify size in aix, it is asked like this
SIZE of file system (in 512-byte blocks)
I never seem to grasp this, what is the equation to get say
500mb? Or is there a program anyone knows of that does this, like a... (1 Reply)
Discussion started by: csaunders
1 Replies
2. Shell Programming and Scripting
I want to convert string into uppercase string. How can i do that ? Ex: Enter the user name:
read name
show=upper(name)
echo $show --- This output should be the uppercase output.
Thanks (3 Replies)
Discussion started by: dreams5617
3 Replies
3. SCO
I use Sco_Sv 3.2v5.0.5 with parellel conection using dump terminals and i want to convert them to desktop pc.
Anybody knows what hardware and other thing that would be involved? (3 Replies)
Discussion started by: seeyou
3 Replies
4. Shell Programming and Scripting
Hi - I have seen some similar posts but I am a bit stumped here
below is the first line of a 'od -c filename' command. I want to change the \0 to \n
0000000 l s \0 c d - \0 c d . . \0 l s
I have tried a sed construct in a script.........
sed... (2 Replies)
Discussion started by: ajcannon
2 Replies
5. SCO
Hi everybody
Is there any sco unix command to convert .so library to .a
(under sco unix openserver.5.0.6)
tnx (2 Replies)
Discussion started by: javad1_maroofi
2 Replies
6. UNIX for Advanced & Expert Users
I have a file that ends with a ctlU:
> cat -v test.file
blah,blah,blah,GEAEA*1*xx0000111xxx^UIEA*xxx0^U
would like to replace the ctlU (^U) with a "\12"...due to printers or something.
I believe I might be able to utilize the tr command, if I could only identify the correct... (4 Replies)
Discussion started by: mr_manny
4 Replies
7. Shell Programming and Scripting
I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly:
if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies
8. Shell Programming and Scripting
Hello,
I am trying to convert a line into a list using awk or sed.
Line:
345 897 567 098 123
output:
345
897
567
098
123
thanks (7 Replies)
Discussion started by: smarones
7 Replies
9. Shell Programming and Scripting
Hello folks
I have a txt file of information about journal articles from different fields. I need to convert this information into a format that is easier for computers to manipulate for some research that I'm doing on how articles are cited. The file has some header information and then details... (8 Replies)
Discussion started by: ksk
8 Replies
10. Shell Programming and Scripting
I have Excel file with the below three columns, i need your expertise in converting this to .csv file delimiter "|"
Excel -
Serial Number Serial Name Serial Brand
111 test sample
123 test2 sample1
134 ... (9 Replies)
Discussion started by: kiran_hp
9 Replies
LEARN ABOUT SUSE
pdl::char
Char(3) User Contributed Perl Documentation Char(3)
NAME
PDL::Char -- PDL subclass which allows reading and writing of fixed-length character strings as byte PDLs
SYNOPSIS
use PDL;
use PDL::Char;
my $pchar = PDL::Char->new( [['abc', 'def', 'ghi'],['jkl', 'mno', 'pqr']] );
$pchar->setstr(1,0,'foo');
print $pchar; # 'string' bound to "", perl stringify function
# Prints:
# [
# ['abc' 'foo' 'ghi']
# ['jkl' 'mno' 'pqr']
# ]
print $pchar->atstr(2,0);
# Prints:
# ghi
DESCRIPTION
This subclass of PDL allows one to manipulate PDLs of 'byte' type as if they were made of fixed length strings, not just numbers.
This type of behavior is useful when you want to work with charactar grids. The indexing is done on a string level and not a character
level for the 'setstr' and 'atstr' commands.
This module is in particular useful for writing NetCDF files that include character data using the PDL::NetCDF module.
FUNCTIONS
new
Function to create a byte PDL from a string, list of strings, list of list of strings, etc.
# create a new PDL::Char from a perl array of strings
$strpdl = PDL::Char->new( ['abc', 'def', 'ghij'] );
# Convert a PDL of type 'byte' to a PDL::Char
$strpdl1 = PDL::Char->new (sequence (byte, 4, 5)+99);
$pdlchar3d = PDL::Char->new([['abc','def','ghi'],['jkl', 'mno', 'pqr']]);
string
Function to print a character PDL (created by 'char') in a pretty format.
$char = PDL::Char->new( [['abc', 'def', 'ghi'], ['jkl', 'mno', 'pqr']] );
print $char; # 'string' bound to "", perl stringify function
# Prints:
# [
# ['abc' 'def' 'ghi']
# ['jkl' 'mno' 'pqr']
# ]
# 'string' is overloaded to the "" operator, so:
# print $char;
# should have the same effect.
setstr
Function to set one string value in a character PDL. The input position is the position of the string, not a character in the string. The
first dimension is assumed to be the length of the string.
The input string will be null-padded if the string is shorter than the first dimension of the PDL. It will be truncated if it is longer.
$char = PDL::Char->new( [['abc', 'def', 'ghi'], ['jkl', 'mno', 'pqr']] );
$char->setstr(0,1, 'foobar');
print $char; # 'string' bound to "", perl stringify function
# Prints:
# [
# ['abc' 'def' 'ghi']
# ['foo' 'mno' 'pqr']
# ]
$char->setstr(2,1, 'f');
print $char; # 'string' bound to "", perl stringify function
# Prints:
# [
# ['abc' 'def' 'ghi']
# ['foo' 'mno' 'f'] -> note that this 'f' is stored "f "
# ]
atstr
Function to fetch one string value from a PDL::Char type PDL, given a position within the PDL. The input position of the string, not a
character in the string. The length of the input string is the implied first dimension.
$char = PDL::Char->new( [['abc', 'def', 'ghi'], ['jkl', 'mno', 'pqr']] );
print $char->atstr(0,1);
# Prints:
# jkl
perl v5.12.1 2009-10-17 Char(3)