one solution if want fields in a file into each array
Hi Everyone,
This is just my method to if want fields in a file into each array.
As we can see, use this way, then we cut -f2, then can store the 2nd field into an array.
I know this is not a very good efficent way to store each field into each array for a file, but it is just what i can think it out.
It expects input via stdin or a file provided, so call it as either of these:
Besides, it isn't meant to do anything, but to demonstrate how you can replace your system call to cat and cut with pure Perl, shaving off quite some time and resources off a run.
Hello
Just edited the entry to make it easier to understand what i want
How can i achieve this: GOAL:
read 2 field from a table with PSQL
result of this PSQL command is this
INSTALLEDLANG=$(su - postgres -c "psql -A -t -q -c -d ${DBNAME} -t -c 'SELECT code, iso_code from res_lang'")
... (0 Replies)
I want to compare these files while putting $1 and $2 into an array and getting rid of the punctuation. What am i doing wrong?
File1.txt
Apple # 223
Peach # 84;
Banana # 1605.
Banana # 1605;
Orange # 6;
Peach # 84
Peach # 84;
Apple # 229;
Banana # 1605.
Peach # 84
Apple, # 229;... (3 Replies)
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)
consider this is a line A#B#C#D#E#F#G#H
note the delimeter is #
i want to cut or spilt in to fields using the delimeter # and to store in an array.
like this
array=A
array=B
array=C
array=D
array=E
and the array content should be displayed.
echo "${array}"
echo "${array}"... (5 Replies)
I was wondering if ksh supported arrays. I have a script that may work with several hosts. I'd like a means of knowing how many hosts I'm working with and an easy way to access them (as variables) in a loop. I'm assuming there's some kind of foreach in shell scripting. (1 Reply)
I want to read $3,$4,$5,$6,$7 of fileA in array and when
fileb $1 = fileA $4
the i want to print array and few fields from fileB.
This should work but has some syntax error.
nawk -F, 'FNR==NR{a=;next} a{print a}' fileB fileA
Appreciate if someone can correct this. (2 Replies)
I need to split a long varible which is a whole line read from a file into fields and store them in an array, the fields are delimited by pipe and a field may contain white spaces.
I tried the following concept test and it has problem with field 5 which contain a space, appearently so because... (3 Replies)