Sponsored Content
Top Forums Shell Programming and Scripting Remove spaces / tabs from variable in script Post 302580589 by zaxxon on Friday 9th of December 2011 01:58:37 AM
Old 12-09-2011
Looks like you are mixing up shell with awk.
Shell does not know about $90. In awk this would be field $90, yes.
On the other side defining a shell variable which's name is consisting only of numeric characters does not work, so you are definetly mixing up things.
Also the function length() is an awk function.

I don't understand if you already extracted field 90 and it has a lot of spaces in it so it produces a length of 158 instead of 3 or if you have a complete line where field 90 is not even extracted yet?

Maybe post the line using code tags and tell if you only want to measure it's length or also get it's output printed, thanks.
This User Gave Thanks to zaxxon For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting tabs in to spaces.

Hi! I'm using SunOS 5.7 w/ Bash 2.01. Currently, I'm working on a script that will make it possible to find textfiles which match certain criteria. While I write this message, I had some brainfarts, found the answer myself :D and the question I had in mind is now no longer the question I... (3 Replies)
Discussion started by: indo1144
3 Replies

2. Shell Programming and Scripting

Variable has spaces around the string, need to remove them

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

3. Shell Programming and Scripting

spaces or Tabs?

When formatting a script let's say for instance the following: case ${choice} in 1) vi ${tmp1}.tmp # overwrite the tmp1 var with any user changes cp ${tmp1}.tmp ${tmp1} ;; ... (2 Replies)
Discussion started by: llsmr777
2 Replies

4. Shell Programming and Scripting

Replacing tabs with spaces

I want my program to replace tabs with spaces.1tab=4spaces.When i write aa(tab)aaa(tab)(tab)a(tab) it must show me aaxxaaaxxxxxaxxx. I think that my program works corectly but when a write aaa(tab)a it must show aaaxa but it is aaaxxxxxa.Please for help!!! That is my code: #include <stdio.h> ... (3 Replies)
Discussion started by: marto1914
3 Replies

5. Shell Programming and Scripting

How to remove trailing spaces from a variable?

I am getting a value from a csv file using CUT command, however the command extracting the records with trailing spaces. I am using the result into a sql session to fetch data, because of the trailing spaces the sql session is unable to fetch any data. Please let me know, how to remove this... (2 Replies)
Discussion started by: mady135
2 Replies

6. Shell Programming and Scripting

spaces to tabs - group with IP

hi buddies; i have a file.txt: Note: All the seperators are SPACE. 192.168.1.1 ParameterObject=1 Speech 1 ParameterObject=2 Speech 1 192.168.1.1 ParamFunction=1 UserID 1 (DEACTIVATED) Sector=1,Device=2,Unit=3 DeviceId 1 192.168.1.1 FeederCable=2B ... (18 Replies)
Discussion started by: gc_sw
18 Replies

7. Shell Programming and Scripting

In bash script, how to assign output of a command to a variable while keeping tabs?

Hi, wondering if it's been asked before but didn't find matches from google. Basically I have this line: myvar=$(echo -e "a\tb") Now somehow the '\t' from the echo output gets replaced with white space and then stored in $myvar. It creates a problem for me later to use tab as delimiter to do... (2 Replies)
Discussion started by: birddie
2 Replies

8. Shell Programming and Scripting

Unix remove white spaces/tabs before & after pattern

Hi All, I wanted to know is there any way we can remove white spaces/tabs before & after some pattern { eg. before & after "," }. Please find below sample data below, Sat Jul 23 16:10:03 EDT 2011 , 12345678 , PROD , xyz_2345677 , testuuyt , ... (3 Replies)
Discussion started by: gr8_usk
3 Replies

9. Shell Programming and Scripting

PERL : Remove spaces in a variable

I have a variable I want to remove the spaces in between. The output should be How can this be done Any help will be appreciated. Thanks in advance (1 Reply)
Discussion started by: irudayaraj
1 Replies

10. Shell Programming and Scripting

How to remove leading and trailing spaces for variable in shell script?

Hi I have variable named tablename. The value to tablename variable has leading and trailing white spaces. How to remove the leading and training white spaces and write the value of the tablename without space to a file using shell script. ( for e.g. tablename= yyy ) INPUT ... (10 Replies)
Discussion started by: pottic
10 Replies
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
All times are GMT -4. The time now is 04:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy