Hi All,I am facing the below problem I have set a variable:
the output is coming
however the actual ouput is
There are 4spaces between 300 and 3215 so if i do:
echo "$a" I am getting correct output:
Now I have to concatenate value of a to some variable $b and assign to $c.
So i am not getting the correct value in $c it is having trimmed spaces output.
Please advice why the spaces are trimmed and how to get the correct value in $c variable.
Last edited by methyl; 05-04-2012 at 07:47 AM..
Reason: Please use code tags. Laid out post for readability. Corrected some grammar and spacing.
Use double quotes around variables to avoid trimming of spaces. Look at the below example carefully. You'll understand what shell is doing to those extra whitespaces.
Nothing obvious wrong. When checking the vaue of $c, remember the quotes:
For future posts, please mention what Operating System and version you are running and what Shell you are using. Also please use CODE tags to preserve space characters in your posts (which are certainly important to this post).
I'm trying to print out integers and space/newline for a nicer output, for example, every 20 integers in a row with ternary operator.
In C I could do it with:printf("%d%s",tmp_int, ((j+1)%20) ? "\t":"\n"); but could not figure out the equivalent in C++:
cout << ((j+1)%20)?... (4 Replies)
When I try to access my website's Administrator page (mysite.com/administrator), I'm redirected to (mysite.comadministrator), as if the slash was removed from the URL
The funny thing is that I can access it if I enter 2 slashes (mysite.com//administrator)
Any ideas of what might be causing it? (4 Replies)
Hi,
I have a requirement to find and replace contents from multiple files.
I am able to replace the contents. but i am facing a issue while replacing when finding a certain charcter pattern as unix is treating this is a command.
Please find below sample on the same
Output file to be generated... (1 Reply)
I have an AWK script that uses multiple delimiters in the FS variable.
FS="+"
My awk script takes a file name such as this:
12345_smith_bubba_12345_20120215_4_0.pdf and parses it out based on the under score. Each parsed field then has some code for data validation etc.
This script has... (12 Replies)
Dear Friends,
I want to move all the files to temp folder except files having following extensions which are case sensitive.
.ttM
.Hmt
.dMt
Request you to guide me to do the same
Thank you in advance
Anushree (3 Replies)
Good afternoon! Im new at scripting and Im trying to write a script to
calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Hi
We use # sign to ignore any line (i.e. comment ). But is it possible to ignore group of line at once or i have to use # in front of each line.
Thanks
Sarbjit (3 Replies)
Hi everyone,
$ more abcdefg.ksh
abcdef
alpha beta gamma
abcdef
abcdef
lmnop
$ wc sachin1.ksh
5 7 132 abcdefg.ksh
if you see it shows that file has got 240 characters. I actually want to count how many characters... (1 Reply)
Hi,
I downloaded the latest sparc ver of sol10, tried to concatenate the files and encounter error: Not enough space on the disk. Tried from both sol10 x86 and winxp.
command used:
UNIX: cat file1 file2 file3 file4 file5 > file.iso
DOS: copy /b file1 + file2 + file3 + file4 + file5 file.iso... (3 Replies)