Visit Our UNIX and Linux User Community

Get all values separated with spaces(solved)

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Get all values separated with spaces(solved)
# 1  
Old 01-25-2011
Get all values separated with spaces(solved)

Hi, i have this text:

X (m) 4917536.9627 4917536.9673 0.0090 -0.0046
Y (m) -815726.1383 -815726.1294 0.0061 -0.0089
Z (m) 3965857.4730 3965857.4840 0.0071 -0.0110

X (m) 4917536.9627 4917537.1411 -0.1784 0.1710
Y (m) -815726.1383 -815726.4859 0.3476 0.3489
Z (m) 3965857.4730 3965857.1207 0.3523 0.3698

X (m) 4917537.8768 4917536.9176 0.0091 0.9593
Y (m) -815727.7791 -815726.1229 0.0062 -1.6562
Z (m) 3965857.0042 3965857.4418 0.0072 -0.4376

X (m) 4917536.9176 4917537.1411 -0.2235 0.2222
Y (m) -815726.1229 -815726.4859 0.3630 0.3595
Z (m) 3965857.4418 3965857.1207 0.3211 0.3280

3965858.087 2009/08/15

1 STAX CASC 09:228:00019 m 4917536.920707524754
2 STAY CASC 09:228:00019 m -815726.122450050898
3 STAZ CASC 09:228:00019 m 3965857.444237594958

X: 4917537.752(m) 0.041(m)
Y: -815726.233(m) 0.014(m)
Z: 3965858.090(m) 0.024(m)

CASC 4917536.9151 -815726.1162 3965857.4368 ITRF2005

and i want to get all values that are separate with a space and put them in a variable.

Can any body help me?


---------- Post updated at 06:59 AM ---------- Previous update was at 06:43 AM ----------

I found the answer. Thanks any way
# 2  
Old 01-27-2011
Could you post the answer?
# 3  
Old 01-27-2011
The answer is:
first i get the line that i want like this
variable=`head -n 4 file | tail -n 1`

the i get the position of the string:
varx1=`echo $variable | awk '{ print $4 }'`

print is the position of the string

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get the values of multipledot(.) separated fields?

Hello, I have a file which has the following contents : thewall............0000000000200000 kmemfreelater......0000000000000000 kmemgcintvl........0000000000000002 kmeminuse..........00000000223411C0 allocated..........0000000029394000 bucket.......... @.F1000A02800C2158 The mentioned... (4 Replies)
Discussion started by: rahul2662
4 Replies

2. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

3. Shell Programming and Scripting

Needs help in parsing comma separated values

hello experts, i am retrieving values in variables jobKey and jobName within my shell script. these values are returned to me within braces and i am using following command to remove those braces: jobKeys=`echo $jobKeys | sed 's:^.\(.*\).$:\1:'` jobNames=`echo $jobNames | sed... (1 Reply)
Discussion started by: avikaljain
1 Replies

4. UNIX for Dummies Questions & Answers

[solved] Comma separated values to space separated

Hi, I have a large number of files which are written as csv (comma-separated values). Does anyone know of simple sed/awk command do achieve this? Thanks! ---------- Post updated at 10:59 AM ---------- Previous update was at 10:54 AM ---------- Guess I asked this too soon. Found the... (0 Replies)
Discussion started by: lost.identity
0 Replies

5. Shell Programming and Scripting

To agregate Comma separated values

Hi pls help me to get the code: i have a file in which content is : 2.01304E+11 2.01304E+11 ori 2 01:00 2.01304E+11 2.01304E+11 ori 2 01:02 2.01304E+11 2.01304E+11 ori 3 01:02 2.01304E+11 2.01304E+11 ori 3 ... (7 Replies)
Discussion started by: Aditya.Gurgaon
7 Replies

6. Shell Programming and Scripting

grep on string separated by spaces

hi I am on AIX 5 and i have a script that runs the following command to list processes running. I then want to kill the returned processes. The PID are on field 2 separated by spaces. $ ps -ef|grep "rams.e $PORT" lesqa 1826998 2646248 0 11:20:35 pts/2 0:00 grep rams.e t24cm 2789380 ... (3 Replies)
Discussion started by: dustytina
3 Replies

7. Shell Programming and Scripting

How to loop through space separated values?

How do I loop thru space separated values in a variable? I hate to use very complicated counter increment logic for this kind of simple problem. Expected result(using ksh) $>echo "aaa bbbb cccc" | <looping code here> var=aaa var=bbbb var=cccc $>echo "aaa bbbb cccc" | while IFS=" "... (12 Replies)
Discussion started by: kchinnam
12 Replies

8. Shell Programming and Scripting

Extracting the values separated by comma

Hi, I have a variable which has a list of string separated by comma. for ex , Variable=/usr/bin,/usr/smrshbin,/tmp How can i get the values between the commas separately using shell scripts.Please help me. Thanks, Padmini. (6 Replies)
Discussion started by: padmisri
6 Replies

9. Programming

Concatenating array of strings into one string separated by spaces

Hi, Well as the title says, I have an array of strings (delimited by null). The length of the array is variable and length of each string is variable as well. What I need is one huge string with the original strings in the array separated by spaces. For example is an array is such that array... (12 Replies)
Discussion started by: newhere
12 Replies

10. Shell Programming and Scripting

Splitting comma separated values into an array

I'm attempting to create a KSH array out of a string like this: ",,,value1,value2,," I have created the array but I only get two elements, one for value1 and one for value2. I have ended up with something like this but I don't like it: set -A JUNK xx=0 for i in $(print ",,,value1,value2,,"... (3 Replies)
Discussion started by: tmarikle
3 Replies

Featured Tech Videos