Sponsored Content
Top Forums Shell Programming and Scripting parse a file and fill an array with it Post 302192382 by jbmukund on Tuesday 6th of May 2008 08:14:25 PM
Old 05-06-2008
RE: parse a file and fill an array with it

Hi Franklin,
I tried to run by changing the config file to my config as mentioned erlier.
It prints onyl the last field (word) in the config file 3 times and does not fill anything else apart form it.

I did not understand why r u looping starting form '2'.
However, I changed it to 0 and 1 and did not get the expected result.

Regards,
Mukund Jampala

Quote:
Originally Posted by Franklin52
You can try something like this:

Code:
awk '{for(i=2;i<=NF;i++){print $NF}}' "config.file" |
while read mach; do
  #do your stuff here
  echo "$mach"
done

Regards
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Read directory and fill a file with this information

Hello All, Got a question to make a script what reads a directory and put the file names from that directory in a file with some extra text. ls /tempdir output is: file1.gfh file2.txt file4.zzz these file names (always with an extention) must be placed in a line and written to... (2 Replies)
Discussion started by: ToXiQ
2 Replies

2. Shell Programming and Scripting

Need to parse file "x" lines at a time ... awk array?

I have files that store multiple data points for the same device "vertically" and include multiple devices. It repeats a consistant pattern of lines where for each line: Column 1 is a common number for the entire file and all devices in that file Column 2 is a unique device number Column 3 is... (7 Replies)
Discussion started by: STN
7 Replies

3. Shell Programming and Scripting

How to fill data from other file and get some output

Greetings, I have a hard time creating a large number of user profiles in a database. The data file looks like this : 01/01/80 Mitch Conley . . . . And I need to put the output into: Name: Mitch Surname: Conley Birthday: 01/01/80 Thanks in advance! (3 Replies)
Discussion started by: hemo21
3 Replies

4. UNIX for Dummies Questions & Answers

Fill fields with awk from an array?

Hi experts, I have been trying for a while to accomplish the following task using awk, and I just don't seem find find a way. I am not particular about using awk, it just seemed like the logical choice at first. I have a file that contains 5 fields that are delimited by a space character.... (1 Reply)
Discussion started by: GermanicGalore
1 Replies

5. Shell Programming and Scripting

Script which fill data in XML file

Hello, I need help for writing a script that fills already generated xml file with data from oracle database and random sequences. For example if we have the following tags: <ns1:message> <ns1:messageId> </ns1:messageId> <ns1:languageCode> </ns1:languageCode>... (10 Replies)
Discussion started by: zb99
10 Replies

6. Emergency UNIX and Linux Support

Script to fill the file system mount with empty files to desired size

We are regularly using for our testing, where we are manually filling up the mount with desired size with following command dd if=/dev/zero of=file_2GB bs=2048000 count=2000 We are planning to automate the task where taking input for % of size as one input and the name of the file system... (8 Replies)
Discussion started by: chandu123
8 Replies

7. Shell Programming and Scripting

Parse find input into array

I need help parsing the output of find into an array. I need to search 3 directories and find all files older than 31 days old. This is what I have so far. TIME=" -maxdepth 1 -mtime +31" DIR1="/dir1/" DIR2="/dir2/" DIR3="/dir3/" FIND_DIR1=$(find ${DIR1}${TIME}) FIND_DIR3=$(find... (8 Replies)
Discussion started by: jrymer
8 Replies

8. UNIX for Dummies Questions & Answers

Fill csv entire column with content from another text file

I have a csv that looks like this: ,yude-to-nap2,0,0,0,0,0 ,2twis-yude-to-nap2,0,0,0,0,0 ,2tiws-yude-to-nap2,0,0,0,0,0 ,2arcos-yude-to-nap2,0,0,0,0,0 and another file named m1 that has a single line of text as content: Feb 1 15:30:20 How can I fill the whole the empty column of the... (1 Reply)
Discussion started by: RobertoRivera
1 Replies

9. Shell Programming and Scripting

Perl script to fill the entire row of Excel file with color based on pattern match

Hi All , I have to write one Perl script in which I need to read one pre-existing xls and based on pattern match for one word in some cells of the XLS , I need to fill the entire row with one color of that matched cell and write the content to another excel Please find the below stated... (2 Replies)
Discussion started by: kshitij
2 Replies

10. Shell Programming and Scripting

awk to parse section of csv into array

In the awk below I am trying to parse the Sample Name below the section. The values that are extracted are read into array s(each value in a row seperated by a space) which will be used later in a bash script. The awk does execute but no values are printed. I am also not sure how to print in a row... (1 Reply)
Discussion started by: cmccabe
1 Replies
lua-config(1)						      General Commands Manual						     lua-config(1)

NAME
lua-config - Lua configuration information SYNOPSIS
Basic usage gcc ` lua-config --include ` my_prog.c -o my_prog ` lua-config --libs ` DESCRIPTION
The lua-config script allows you to determine useful information about the chosen version of lua running on the Debian GNU/Linux system in use. More information can be found by running lua-config without any arguments. CAVEATS
This script is unique to Debian and as such you shouldn't rely on its presence on every system. Lua is an embedded language by default and different Linux distributions each take a different approach to making it possible to compile with Lua. The pkg-config system also provides a way to look for libraries and is more likely to be supported across different Linux distributions. Debian's pkg-config name for Lua 5.0 is lua50 and the libraries are in lualib50. These pkg-config files can be found in the liblua50-dev and liblualib50-dev packages. AUTHOR
lua-config was written by Daniel Silverstone <dsilvers@debian.org>. This manual page was written by Daniel Silverstone <dsilvers@debian.org>. For the Debian project. It may be used without restriction in any other system. SEE ALSO
lua(1) pkg-config(1) lua-config(1)
All times are GMT -4. The time now is 09:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy