05-13-2008
Spaces getting trimmed off
Hi,
I have a K shell variable which is holding some long data and when i write the content of the variable to a file, its trimming off some of the intermediate spaces.
e.g: variable="BCMSGITADD81206 DOMTAR MULTI PURPOSE SALMON STKCS CTN 0
1387CTNL70 0008.500000011.0000000010.00000005.0000N020.00075.180000050.000005000
04000003NY00500 0100 163 000000 1 1 500 Sheets per Seal; Ream Sea
led; 3"
when i do
echo "$variable" >> file.txt
the file contains the data with some of the spaces trimmed off in between
If i have 11 spaces after BCMSGITADD81206 its becoming 7 and some other spaces also getting trimmed off...
Please give me suggestion what could be the cause for this.
Thanks
Vijay
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help.
echo $SH_VAR | command_line Syntax.
The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies
2. UNIX for Dummies Questions & Answers
Hi! I'm fairly new to UNIX so don't mention that my question is stupid.
I have many problems with spaces in folders and files names.
Let's say I have the following files:
toto.txt
this is toto.txt
in /usr/local/this is a test/
Why the following commands works:
ls "/usr/local/this... (2 Replies)
Discussion started by: darkyoda2
2 Replies
3. Shell Programming and Scripting
param_data=`sqlplus -S $USER/$PASSWRD@$SCHEMA << EOF
SET ECHO OFF NEWP 0 SPA 0 PAGES 0 FEED OFF HEAD OFF TRIMS ON
VARIABLE param_data VARCHAR2(1000);
WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK;
SELECT INTERFACE_ID || '|' || PARAM_FILE || '|' || SESSION_NAME || '|' || PARAM_NAME ||... (2 Replies)
Discussion started by: Nomaad
2 Replies
4. UNIX for Advanced & Expert Users
Hi,
How can I remove the unwanted spaces in the line.
123456 789 ABC DEF. - I wanna remove the sapces in this line, I need the output 123456789ABCDEF.
Pls help me...... (3 Replies)
Discussion started by: sharif
3 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I have a problem where I need to append few spaces(say 10 spaces) for each line in a file whose length is say(100 chars) and others leave as it is.
I tried to find the length of each line and then if the length is say 100 chars then tried to write those lines into another file and use a sed... (17 Replies)
Discussion started by: prathima
17 Replies
6. Shell Programming and Scripting
Hello All,
I am trying to remove all tabspaces and all blankspaces from my file using sed & awk, but not getting proper code. Please help me out.
My file is like this (<b> means one blank space, <t> means one tab space)-
$ cat file
NARESH<b><b><b>KUMAR<t><t>PRADHAN... (3 Replies)
Discussion started by: NARESH1302
3 Replies
7. Shell Programming and Scripting
Hi All,
I am facing a peculiar situation. I have an output from some commands as below
# cat /export/home/FPPCCYHT | head -1 | cut -d"'" -f2 | cut -d"'" -f1
LLM10 01 0100:0240
If i assign this to a variable and then echo instead of 2 spaces only 1 space is appearing, meaning 1 space is being... (5 Replies)
Discussion started by: digitalrg
5 Replies
8. Shell Programming and Scripting
Hello,
When I give:
rm -f /usr/local/tomcat/temp_img/\Images\ for\ UAT/0918-721-163-001-4C-P_04.jpg
, the file is being deleted.
I am trying to do the same in a script as follows:
Step 1:
A file named del.txt will have the following (list of files to be deleted):... (6 Replies)
Discussion started by: risshanth
6 Replies
9. Shell Programming and Scripting
Input:
TCAMPBMG0064X344F4E1 1 47552 85.280 557.600 11300
TCAMPBMG0064X352F8E1 1 61265 85.280 718.400 11463
TCAMPBMG0064X344F4E1 1 47552 85.280 557.600 11300
TCAMPBMG0064X352F8E1 1 61265 ... (2 Replies)
Discussion started by: satish1222
2 Replies
LEARN ABOUT DEBIAN
gpm.conf
GPM.CONF(5) BSD File Formats Manual GPM.CONF(5)
NAME
gpm.conf -- startup configuration file for gpm
DESCRIPTION
gpm.conf specifies options to be passed to the gpm daemon at start time. It is parsed by the init script, rather than by gpm itself. It
comprises variable assignments in Bourne shell syntax: variable=value (with no extra spaces; to embed spaces or other shell metacharacters in
values, use quotes as in shell scripting). Blank lines and lines beginning with a hash ("#") are ignored.
Settings are implemented by setting flags on the gpm command line; these are documented in gpm(8). The following variable names are speci-
fied:
device Specifies the device file for your primary mouse. This sets -m.
type Specifies the protocol for your primary mouse. This sets -t.
device2, type2
The same as device and type, but for your secondary mouse. These set -m and -t after passing -M. If either of these are
defined, both must be.
responsiveness
Specifies the responsiveness for your primary mouse. This sets -r.
sample_rate Specifies the sample rate for your primary mouse. This sets -s.
repeat_type Enables the gpm repeater and sets the repeater protocol, using the -R flag. Repeat type none or an empty value will disable
the repeater.
append Any options specified here are appended to the gpm command line. If you use multiple options, you will need to enclose the
value in quotes ("").
EXAMPLES
A simple gpm.conf file for a PS/2 mouse whose protocol should be autodetected, and which should be repeated in /dev/gpmdata as a serial Mi-
crosoft Intellimouse:
# Sample gpm.conf
device=/dev/psaux
type=autops2
repeat_type=ms3
This will cause the daemon to be started as gpm -m /dev/psaux -t autops2 -Rms3.
FILES
/etc/gpm.conf
SEE ALSO
gpm(8), dpkg-reconfigure(8). dpkg-reconfigure gpm can be used to generate and update the gpm.conf file automatically.
Debian 3.0 January 5, 2005 Debian 3.0