Sponsored Content
Top Forums Shell Programming and Scripting Not getting array in .awk file and print it Post 302902580 by nes on Wednesday 21st of May 2014 07:58:10 AM
Old 05-21-2014
Thanks Akshay,

Whne I tried as below code, no is giving the 0 value and for that resion not getting any value from array. Please help me on this... Smilie
OUTPUT like :
0
After spliting

but not getting array elements...

Code:
        no = split(TempArr, Temp);
        print no;
        print "After spliting";
        for(i in Temp)
        {
                print Temp[i];
        }

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

saving values in file in an array in awk

hi i am trying to save values in a file in an array in awk..the file is as follows: 0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0, so far i have this: awk 'BEGIN {RS="\n";FS=","} { for(i=1;i<=NR;i++) { for(j=1;j<=NF;j++) { a=$j; } } (4 Replies)
Discussion started by: npatwardhan
4 Replies

2. Shell Programming and Scripting

awk: reading into an array and then print the value corresponding to index

I am beginner in awk awk 'BEGIN{for(i=1;(getline<"opnoise")>0;i++) arr=$1}{print arr}' In the above script, opnoise is a file, I am reading it into an array and then printing the value corresponding to index 20. Well this is not my real objective, but I have posted this example to describe... (19 Replies)
Discussion started by: akshaykr2
19 Replies

3. Shell Programming and Scripting

AWK separating a file into an array

Is there a way to have awk put successive records into an array in a bash script? I have files that say things like name :title :salary Bob :Instructor :30,000 Joyce :Instructor :30,000 Patrick :Manager :40,000 What I want to do is seperate this file into an array so that... (8 Replies)
Discussion started by: tgidzak
8 Replies

4. Shell Programming and Scripting

Print @array content to a file

Hi, as the title, I have an array @f_lines with gene information in it. How can I put the content of @f_lines into a file so that I can read it? I tried this: open(OUTPUT, "file"); # put gene information in this file; @f_lines = ("gene1", "gene2", "gene3"...); # gene information; print... (3 Replies)
Discussion started by: lyni2ULF
3 Replies

5. Shell Programming and Scripting

Print array into a single file - AWK

Hi all, I been looking for a solution to the fact that when I use: for (i=1; i<=NF; i++) print $ifields that are originally in a single line are printed in a single line I have severals files for which the first 7 are the same, but the number of variables after that can vary, for example NF... (5 Replies)
Discussion started by: PaulaL
5 Replies

6. Shell Programming and Scripting

Perl - use search keywords from array and search a file and print 3rd field when matched

Hi , I have been trying to write a perl script to do this job. But i am not able to achieve the desired result. Below is my code. my $current_value=12345; my @users=("bob","ben","tom","harry"); open DBLIST,"<","/var/tmp/DBinfo"; my @input = <DBLIST>; foreach (@users) { my... (11 Replies)
Discussion started by: chidori
11 Replies

7. Shell Programming and Scripting

Awk: Print count for column in a file using awk

Hi, I have the following input in a file & need output as mentioned below(need counter of every occurance of field which is to be increased by 1). Input: 919143110065 919143110065 919143110052 918648846132 919143110012 918648873782 919143110152 919143110152 919143110152... (2 Replies)
Discussion started by: siramitsharma
2 Replies

8. UNIX for Dummies Questions & Answers

How To Print Array in awk?

Hello, May i please know how do i print the array using awk script. I am using below shell script to start with but not working. #!/bin/bash LOADSTATUS="Line 0" LOADSTATUS="Line 1" LOADSTATUS="Line 2" LOADSTATUS="Line 3" LOADSTATUS="Line 4" awk ' BEGIN { Your File Load Status }... (1 Reply)
Discussion started by: Ariean
1 Replies

9. Shell Programming and Scripting

Append awk results into file or array

for a in {1..100} do awk '{ sum+=$a} END {print sum}' a=$a file1 > file2 done I know I will get only one number if following the code above, how can I get 100 sum numbers in file2? (2 Replies)
Discussion started by: wanliushao
2 Replies

10. Shell Programming and Scripting

awk to print array that occurs the most with matching value in another field

In the below awk I am splitting $7 on the : and then counting each line or NM_xxxx. If the $1 value is the same for each line then print the $7 that occurs the most with the matching $1 value. The awk seems close but I am not sure what is going on. I included a description as well as to what I... (1 Reply)
Discussion started by: cmccabe
1 Replies
DBADB(1)						      General Commands Manual							  DBADB(1)

NAME
dbadb - Manage the DB-ALLe database SYNOPSIS
dbadb [command] [options] [args...] DESCRIPTION
It allows to initialise the database, dump its contents and import and export data using BUFR, CREX or AOF encoding. dbadb always requires a non-switch argument, that indicates what is the operation that should be performed: help Print a help summary. help manpage Print this manpage. dump [options] [queryparm1=val1 [queryparm2=val2 [...]]] Dump data from the database. Query parameters are the same of the Fortran API. Please see the section "Input and output parameters -- For data related action routines" of the Fortran API documentation for a complete list.. wipe [options] [optional rep_memo description file] Reinitialise the database, removing all data. Reinitialisation is done using the given report code description file. If no file is provided, a default version is used. import [options] [filter] filename [filename [ ... ] ] Import data into the database. export [options] rep_memo [queryparm1=val1 [queryparm2=val2 [...]]] Export data from the database. Query parameters are the same of the Fortran API. Please see the section "Input and output parame- ters -- For data related action routines" of the Fortran API documentation for a complete list.. repinfo [options] [filename] Update the report information table. Update the report information table with the data from the given report code description file. If no file is provided, a default version is used. cleanup [options] Perform database cleanup operations. The only operation currently performed by this command is deleting stations that have no val- ues. If more will be added in the future, they will be documented here.. stations [options] [queryparm1=val1 [queryparm2=val2 [...]]] List the stations present in the database. Query parameters are the same of the Fortran API. Please see the section "Input and out- put parameters -- For data related action routines" of the Fortran API documentation for a complete list.. delete [options] [queryparm1=val1 [queryparm2=val2 [...]]] Delete all the data matching the given query parameters. Query parameters are the same of the Fortran API. Please see the section "Input and output parameters -- For data related action routines" of the Fortran API documentation for a complete list.. OPTIONS
dbadb follows the usual GNU command line syntax, with long options starting with two dashes (`-'). Options used to connect to the database --dsn=dsn DSN, or URL-like database definition, to use for connecting to the DB-All.e database (can also be specified in the environment as DBA_DB) --user=user username to use for connecting to the DB-All.e database --pass=pass password to use for connecting to the DB-All.e database --wipe-first wipe database before any other action Options used to filter messages --category=num match messages with the given data category --subcategory=num match BUFR messages with the given data subcategory --check-digit=num match CREX messages with check digit (if 1) or without check digit (if 0) --unparsable match only messages that cannot be parsed --parsable match only messages that can be parsed --index=expr match messages with the index in the given range (ex.: 1-5,9,22-30) Option for command dump -?, --help print an help message --verbose verbose output Option for command wipe -?, --help print an help message --verbose verbose output Option for command import -?, --help print an help message --verbose verbose output -t type, --type=type format of the input data ('bufr', 'crex', 'aof', 'csv') -f, --overwrite overwrite existing data -r rep, --report=rep force data to be of this type of report, specified with rep_cod or rep_memo values --fast Ignored. This option is left here for compatibility with old versions of dbadb. --no-attrs do not import data attributes --full-pseudoana merge pseudoana extra values with the ones already existing in the database --precise import messages using precise contexts instead of standard ones Option for command export -?, --help print an help message --verbose verbose output -r rep, --report=rep force exported data to be of this type of report, specified with rep_cod or rep_memo values -d type, --dest=type format of the data in output ('bufr', 'crex', 'aof') -t name, --template=name template of the data in output (autoselect if not specified, 'list' gives a list) --dump dump data to be encoded instead of encoding it Option for command repinfo -?, --help print an help message --verbose verbose output Option for command cleanup -?, --help print an help message Option for command stations -?, --help print an help message Option for command delete -?, --help print an help message TEMPLATE NAMES
This is a list of possible template names for the --template switch: acars ACARS (autodetect) acars-ecmwf ACARS ECMWF (4.145) acars-wmo ACARS WMO airep AIREP (autodetect) airep-ecmwf AIREP ECMWF (4.142) amdar AMDAR (autodetect) amdar-ecmwf AMDAR ECMWF (4.144) amdar-wmo AMDAR WMO buoy Buoy (1.21) generic Generic (255.0) metar Metar (0.140) pilot Pilot (2.91) pollution Pollution (8.171) ship Synop ship (autodetect) ship-abbr Synop ship (abbreviated) (1.9) ship-auto Synop ship (auto) (1.13) ship-plain Synop ship (normal) (1.11) ship-reduced Synop ship (reduced) (1.19) synop Synop (autodetect) synop-ecmwf Synop ECMWF (autodetect) (0.1) synop-ecmwf-auto Synop ECMWF land auto (0.3) synop-ecmwf-land Synop ECMWF land (0.1) synop-ecmwf-land-high Synop ECMWF land high level station (0.1) synop-wmo Synop WMO (0.1) temp Temp (autodetect) temp-ecmwf Temp ECMWF (autodetect) temp-ecmwf-land Temp ECMWF land (2.101) temp-ecmwf-ship Temp ECMWF ship (2.102) temp-ship Temp ship (autodetect) temp-wmo Temp WMO (2.101) wmo WMO style templates (autodetect) --template=list will also print the list. AUTHOR
dbadb has been written by Enrico Zini <enrico@enricozini.com> for ARPA Emilia Romagna, Servizio Idrometeorologico. may 16, 2012 DBADB(1)
All times are GMT -4. The time now is 12:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy