10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear all,
I would like to insert N blankspaces in front of a string using sed command
To give an example (N=10), I tried that code:
$ echo "abcd" | sed 's/^/ \{10,\}&/'
but I failed, by obtaining that result:
{10,}abcd
Any help would be greatly appreciated,
Thanks in advance,... (18 Replies)
Discussion started by: dae
18 Replies
2. Shell Programming and Scripting
Suppose, I have a variable var=" name is ".
I want to remove the blank spaces from the begining and endonly, not from the entire string.
So, that the variable/string looks like following
var="name is".
Please look after the issue. (3 Replies)
Discussion started by: mady135
3 Replies
3. Shell Programming and Scripting
Hi,
I am trying to remove spaces from the beginning of a string (which i am using in my shell script). For ex - my string looks like this -
" no rows selected"
and i want the string to look like this -
"no rows selected"
How can i achieve this?
Thanks! (18 Replies)
Discussion started by: shrutihardas
18 Replies
4. Shell Programming and Scripting
Hi,
I have a string like this and i want to remove extra spaces that exists between the words.
Here is the sentence.
$string="The small DNA genome of hepadnaviruses is replicated by reverse transcription via an RNA intermediate. This RNA "pregenome" contains ... (2 Replies)
Discussion started by: vanitham
2 Replies
5. Shell Programming and Scripting
Dear All,
can you please advice how do i remove trailing and leading spaces from a pipe-delimited file using "tr" command
the below cmd, i tried removed all spaces
tr -d ' '<s1.txt>s2.txt1
Many thx
Suresh (5 Replies)
Discussion started by: sureshg_sampat
5 Replies
6. Shell Programming and Scripting
seems easy but havent found in other posts...
i want to delete any spaces if found before first occurence of ${AI_RUN}
sed 's/ *\\$\\{AI_RUN\\}/\\$\\{AI_RUN\\}/' $HOME/temp1.dat
i think i'm close but can't put my finger on it. :rolleyes: (6 Replies)
Discussion started by: danmauer
6 Replies
7. Shell Programming and Scripting
Hello, Im writing a script that works by recursively going into directories with find. But I have some directories that have spaces in them.. so I need to parse the variables to add a backslash before the spaces.
Im not exactly sure how how to do this in bash, and honestly I dont think I know... (3 Replies)
Discussion started by: trey85stang
3 Replies
8. Shell Programming and Scripting
can any help how to remove blank spaces in a string?
STR="GOOD BYE"
by removing blank spaces, the string should be GOOD,BYE
thanks in advance (2 Replies)
Discussion started by: spandu
2 Replies
9. Shell Programming and Scripting
Hi all, I'm a newbie to the Linux world and I got a couple of shell script questions:
(1) How do combine two variables and make it equal to a third variable? For example, I got a variable $A=FirstName, $B=LastName, and I want to combine the variable into one variable so when you echo the final... (4 Replies)
Discussion started by: mikey20
4 Replies
10. Shell Programming and Scripting
Hello,
I have the following to remove spaces from beginning and end of a string.
infile=`echo "$infilename" | sed 's/^ *//;s/ *$//`
How do I modify the above code to remove spaces from beginning, end and in the middle of the string also.
ex:
... (4 Replies)
Discussion started by: radhika
4 Replies