Sponsored Content
Top Forums Shell Programming and Scripting cut -f1 -d"," to a array and loop Post 302470415 by kykyboss023 on Wednesday 10th of November 2010 04:51:21 AM
Old 11-10-2010
Hi

Thanks everyone, i try all the solution propose and the one that work for me was the following , so probleme solve

Code:
 
cut -f5 -d"," $FILE |while read line
        do
            echo $line
            echo yes
        done

there is still sommething i don't understand as somehow as soon as i store the result in a array or variable it does work, the array containt just one argument
but nervermind

Code:
 
bash-2.05b$ array=$(awk -F, '{print "\""$5"\"";}' ETL/Bas_uniq/uniq.csv)
bash-2.05b$ echo ${array[@]}
"CAD MASTER SWAP" "CHF SWAP GOTTEX" "CLP MONEY" "CNY MONEY" "COF DUMMY" "COP MONEY" "CSD MONEY" "CYP DUMMY" "CZK SWAP" "HRK MONEY" "HUF MONEY MASTER CURVE"
 
bash-2.05b$ echo ${array[1]}
 
bash-2.05b$


Last edited by kykyboss023; 11-10-2010 at 05:58 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Windows & DOS: Issues & Discussions

Unix "cut' and "awk" in Windows XP?

Hi, How can I execute Unix's ksh equivalent of "cut' and "awk" in Windows XP? For example, I want to execute ksh commands from Windows command prompt. Is there a place I can download "cut.exe" and "awk.exe" ? Thanks in advance (4 Replies)
Discussion started by: ihot
4 Replies

3. Shell Programming and Scripting

How to cut a file using " ", but fields can be separated with more than one " "

Hello, let's say I have a text file: word11 word12 word13 word21 word22 word23 word31 word32 word33 and I want to put the second field of each line into a list: set list = `cut -d" " -f2 ${1}` and I use space (" ") as a delimiter, only that there's a catch: there can be more than... (12 Replies)
Discussion started by: shira
12 Replies

4. Shell Programming and Scripting

help for saving vertical datas to horizontal with "awk" or "cut"

hi, i have a file having datas like that ./a.txt 12344 12345 12346 12347 ..... ..... ... i want to save this datas to another file like that ./b.txt 12344 12345 12346 12347 ... ... ... i think awk can make this but how? :) waiting for ur help. (3 Replies)
Discussion started by: mercury
3 Replies

5. Programming

C: Initialize "const" array from the "heap"

Hello, I am working on solving an NP-Complete problem, so it is very important that operations and data with limited integer-argument ranges be computed using immutable look-up-tables contained entirely in CPU cache. Retrieval of the look-up-table data must never leave the CPU once initially... (6 Replies)
Discussion started by: HeavyJ
6 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

8. Shell Programming and Scripting

Failure: if grep "$Var" "$line" inside while read line loop

Hi everybody, I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o My code: #!/bin/sh set -e set -u export IFS= optl="Optl" LOCSTORCLI="/opt/lsi/storcli/storcli" ($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
Discussion started by: Subsonic66
5 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
INGRES_CONNECT(3)							 1							 INGRES_CONNECT(3)

ingres_connect - Open a connection to an Ingres database

SYNOPSIS
resource ingres_connect ([string $database], [string $username], [string $password], [array $options]) DESCRIPTION
ingres_connect(3) opens a connection with the given Ingres $database. The connection is closed when the script ends or when ingres_close(3) is called on this link. PARAMETERS
If some parameters are missing, ingres_connect(3) uses the values in php.ini for $ingres.default_database, $ingres.default_user and $ingres.default_password. o $database - The database name. Must follow the syntax: $[vnode::]dbname[/svr_class] o $username - The Ingres user name o $password - The password associated with $username o $options -ingres_connect(3) options +----------------------+-------------------------------------------+---+---+ | Option name | | | | | | | | | | | Option type | | | | | | | | | | Description | | | | | | | | | | Example | | | | | | | | +----------------------+-------------------------------------------+---+---+ |date_century_boundary | | | | | | | | | | | | | | | | integer | | | | | | | | | | The threshold by which a | | | | | 2-digit year is determined to | | | | | be in the current century or | | | | | in the next century. Equiva- | | | | | lent to II_DATE_CEN- | | | | | TURY_BOUNDARY. | | | | | | | | | | 50 | | | | | | | | | group | | | | | | | | | | | | | | | | string | | | | | | | | | | Specifies the group ID of the | | | | | user, equivalent to the "-G" | | | | | flag | | | | | | | | | | payroll | | | | | | | | | role | | | | | | | | | | | | | | | | string | | | | | | | | | | The role ID of the applica- | | | | | tion. If a role password is | | | | | required, the parameter value | | | | | should be specified as | | | | | "role/password" | | | | | | | | | effective_user | | | | | | | | | | | | | | | | string | | | | | | | | | | The ingres user account being | | | | | impersonated, equivalent to | | | | | the "-u" flag | | | | | | | | | | another_user | | | | | | | | | dbms_password | | | | | | | | | | | | | | | | string | | | | | | | | | | The internal database pass- | | | | | word for the user connecting | | | | | to Ingres | | | | | | | | | | s3cr3t | | | | | | | | | table_structure | | | | | | | | | | | | | | | | string | | | | | | | | | | The default structure for | | | | | new tables. Valid values for | | | | | table_structure are: | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_BTREE | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_HASH | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_HEAP | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_ISAM | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_CBTREE | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_CISAM | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_CHASH | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_CHEAP | | | | | | | | | | INGRES_STRUCTURE_BTREE | | | | | | | | | index_structure | | | | | | | | | | | | | | | | string | | | | | | | | | | The default structure for new sec- | | | | | ondary indexes. Valid values for | | | | | index_structure are: | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_CBTREE | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_CISAM | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_CHASH | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_BTREE | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_HASH | | | | | | | | | | oINGRES_STRUC- | | | | | TURE_ISAM | | | | | | | | | | INGRES_STRUCTURE_HASH | | | | | | | | | login_local | | | | | | | | | | | | | | | | boolean | | | | | | | | | | Determines how the connection user | | | | | ID and password are used when a | | | | | VNODE is included in the target | | | | | database string. If set to TRUE, | | | | | the user ID and password are used | | | | | to locally access the VNODE, and | | | | | the VNODE login information is used | | | | | to establish the DBMS connection. | | | | | If set to FALSE, the process user | | | | | ID is used to access the VNODE, and | | | | | the connection user ID and password | | | | | are used in place of the VNODE | | | | | login information to establish the | | | | | DBMS connection. This parameter is | | | | | ignored if no VNODE is included in | | | | | the target database string. The | | | | | default is FALSE. | | | | | | | | | | TRUE | | | | | | | | | timezone | | | | | | | | | | | | | | | | string | | | | | | | | | | Controls the timezone of the ses- | | | | | sion. If not set it will default to | | | | | the value defined by II_TIME- | | | | | ZONE_NAME. If II_TIMEZONE_NAME is | | | | | not defined, NA-PACIFIC (GMT-8 with | | | | | Daylight Savings) is used. | | | | | | | | | date_format | | | | | | | | | | | | | | | | integer | | | | | | | | | | Sets the allowable input and output | | | | | format for Ingres dates. Defaults | | | | | to the value defined by | | | | | II_DATE_FORMAT. If II_DATE_FORMAT | | | | | is not set the default date format | | | | | is US, e.g. mm/dd/yy. Valid values | | | | | for date_format are: | | | | | | | | | | oINGRES_DATE_DMY | | | | | | | | | | oINGRES_DATE_FIN- | | | | | ISH | | | | | | | | | | oINGRES_DATE_GER- | | | | | MAN | | | | | | | | | | oINGRES_DATE_ISO | | | | | | | | | | oINGRES_DATE_ISO4 | | | | | | | | | | oINGRES_DATE_MDY | | | | | | | | | | oINGRES_DATE_MULTI- | | | | | NATIONAL | | | | | | | | | | oINGRES_DATE_MULTI- | | | | | NATIONAL4 | | | | | | | | | | oINGRES_DATE_YMD | | | | | | | | | | oINGRES_DATE_US | | | | | | | | | | INGRES_DATE_MULTINATIONAL4 | | | | | | | | | decimal_separator | | | | | | | | | | | | | | | | string | | | | | | | | | | The character identifier for decimal | | | | | data | | | | | | | | | | "," | | | | | | | | | money_lort | | | | | | | | | | | | | | | | integer | | | | | | | | | | Leading or trailing currency sign. Valid | | | | | values for money_lort are: | | | | | | | | | | oINGRES_MONEY_LEAD- | | | | | ING | | | | | | | | | | oINGRES_MONEY_TRAIL- | | | | | ING | | | | | | | | | | INGRES_MONEY_TRAILING | | | | | | | | | money_sign | | | | | | | | | | | | | | | | string | | | | | | | | | | The currency symbol to be used with the | | | | | MONEY datatype | | | | | | | | | | EUR | | | | | | | | | money_precision | | | | | | | | | | | | | | | | integer | | | | | | | | | | The precision of the MONEY datatype | | | | | | | | | | 3 | | | | | | | | | float4_precision | | | | | | | | | | | | | | | | integer | | | | | | | | | | Precision of the FLOAT4 datatype | | | | | | | | | | 10 | | | | | | | | | float8_precision | | | | | | | | | | | | | | | | integer | | | | | | | | | | Precision of the FLOAT8 data | | | | | | | | | | 10 | | | | | | | | | blob_segment_length | | | | | | | | | | | | | | | | integer | | | | | | | | | | The amount of data in bytes to fetch at a | | | | | time when retrieving BLOB or CLOB data, | | | | | defaults to 4096 bytes when not explic- | | | | | itly set | | | | | | | | | | 8192 | | | | | | | | +----------------------+-------------------------------------------+---+---+ RETURN VALUES
Returns a Ingres link resource on success or FALSE on failure EXAMPLES
Example #1 Open a connection to an Ingres database <?php $link = ingres_connect("mydb", "user", "pass") or die("Could not connect"); echo "Connected successfully"; ingres_close($link); ?> SEE ALSO
ingres_pconnect(3), ingres_close(3). PHP Documentation Group INGRES_CONNECT(3)
All times are GMT -4. The time now is 07:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy