hmm, I am not very clear on what you are trying to do
I tried the following and it is what probably u are looking for
set -a arrData ## this is for kshell, may be it is declare for bash
arrData=`awk ' {
split($0,arr,"::");
printf("%s\n", arr[1]);
printf("%s\n", arr[2]);
printf("%s\n", arr[3]);
}' yourfilename`
Thanks Penguin. I did something like that. The input file will have comments embedded so first I get rid of all the junk and then dynamically create arrays and populate.
The problem I am having now is referencing the created arrays. When I try to dump the content like this I get a bad substitution error. Any ideas? Thanks.
Hello,
I need to split a file by number of records and rename each split file with actual filename pre-pended with 3 digit split number.
What I have tried is the below command with 2 digit numeric value
split -l 3 -d abc.txt F (# Will Produce split Files as F00 F01 F02)
How to produce... (19 Replies)
Hi.. i am running nawk scripts on solaris system to get records of file1 not in file2 and find duplicate records in a while with the following scripts -compare
nawk 'NR==FNR{a++;next;} !a {print"line"FNR $0}' file1 file2duplicate - nawk '{a++}END{for(i in a){if(a-1)print i,a}}' file1in the middle... (12 Replies)
Hello;
I have a file consists of 4 columns separated by tab. The problem is the third fields. Some of the them are very long but can be split by the vertical bar "|". Also some of them do not contain the string "UniProt", but I could ignore it at this moment, and sort the file afterwards. Here is... (5 Replies)
Hi all,
I try to make a awk-script, which counts lines, summarized by pdf and xml.
So far it works, but for sorting reasons, I'd like to change the format from the field $1 from dd-mm-yyyy to yyyy-mm-dd.
This works find, but: split() and sprintf() prints its output (for no reason, the results... (2 Replies)
hi guys,
I am writing a code and have stuck at one point. Inside nawk I am storing my desired variable a, I just need to find if a is present in an external file error.log or not. If yes, print something. grep or for loop not working properly inside nawk. Sample code provided.
nawk '
BEGIN... (5 Replies)
help out with code. two files aaa bbb contains some records..output file xyz should be like this..see below
i/p file:aaa
08350|60521|0000|505|0000|1555|000|NYCMT|Pd_1 |-11878
i/p file: bbb
60521|60510
o/p file :xyz
60510|08350|60521|0000|505|0000|1555|000|NYCMT|Pd_1 |-11878 (5 Replies)
i'm new to shell scripting and have a problem please help me
in the script i have a nawk block which has a variable count
nawk{
.
.
.
count=count+1
print count
}
now i want to access the value of the count variable outside the awk block,like..
s=`expr count / m`
(m is... (5 Replies)
I have gone through all the threads in the forum and tested out different things. I am trying to split a 3GB file into multiple files. Some files are even larger than this.
For example:
split -l 3000000 filename.txt
This is very slow and it splits the file with 3 million records in each... (10 Replies)