Sponsored Content
Full Discussion: awk (Too many open files)
Top Forums Shell Programming and Scripting awk (Too many open files) Post 303012696 by Chubler_XL on Wednesday 7th of February 2018 03:07:13 PM
Old 02-07-2018
Quote:
Originally Posted by disedorgue
Hi,
In another french forum for similar problem, I give a solution like as:
Code:
#!/bin/bash
mkfifo in0 in1 out0 out1
openssl < <(awk 'BEGIN{while(1){print "dgst -out out0 -sha256 in0\ndgst -out out1 -sha256 in1"}}') > /dev/null &
while true ;  do IFS=" " read T X <out$((h++%2)) ; echo -n "$X" ; done &

while read a1 a2 a3 a4 a5 a6  ; do echo -n "$a1 $a2 $a3 $a4 " ; echo -n $a5 >in$((h++%2)) ; echo " $a6" ; done <file

exec 2>/dev/null
jobs -p | xargs kill
rm -f in0 in1 out0 out1

I am getting some synchronization issues with that code:

file:
Code:
word_01 word_02 word_03 word_04 word_05 word_06 word_07
word_11 word_12 word_13 word_14 word_15 word_16 word_17
word_21 word_22 word_23 word_24 word_25 word_26 word_27
word_31 word_32 word_33 word_34 word_35 word_36 word_37
word_41 word_42 word_43 word_44 word_45 word_46 word_47
word_51 word_52 word_53 word_54 word_55 word_56 word_57
word_61 word_62 word_63 word_64 word_65 word_66 word_67
word_71 word_72 word_73 word_74 word_75 word_76 word_77
word_81 word_82 word_83 word_84 word_85 word_86 word_87
word_91 word_92 word_93 word_94 word_95 word_96 word_97
word_A1 word_A2 word_A3 word_A4 word_A5 word_A6 word_A7
word_B1 word_B2 word_B3 word_B4 word_B5 word_B6 word_B7

results:
Code:
word_01 word_02 word_03 word_04  word_06 word_07
word_11 word_12 word_13 word_14 81233e976f89c167d338d9a8cba97fb1e063b4c4514f06693a65c067c36afcdd word_16 word_17
word_21 word_22 word_23 word_24 28829970d9ac7c53e14a246c98fb11e9cb24f4c91a3b03cacf227144cd135334 word_26 word_27
word_31 word_32 word_33 word_34 5a85b70bc0a50d7fa9ad630652ded2e48a3716aa75438eaef7557312c01d7eb5 word_36 word_37
word_41 word_42 word_43 word_44 973568825cf106a3331aea7c42d05b2bdcbd4b4b2761e1efc9043ad5537485cc word_46 word_47
word_51 word_52 word_53 word_54 4fb3737155d728cf1efe4581e980707b40184bedc59eec9523848aa27d4e78b0 word_56 word_57
word_61 word_62 word_63 word_64 4b3a529aa0b718a93c8133647c8cb170887f86d2f10886a39154b88880421f8c word_66 word_67
word_71 word_72 word_73 word_74 14b325115cf1ac8d72920470fe9b6047b753bdd9b33738e856997a3dc29eaef1 word_76 word_77
word_81 word_82 word_83 word_84 d04ce42feb8e2804061d371e0c9c0dedb1f337ca21a33fe6020fcf1f288631d0 word_86 word_87
word_91 word_92 word_93 word_94 005373e5b47d5114156460f869db467bf5d54c89e5fd530a4c395f8eb7c485c1 word_96 word_97
word_A1 word_A2 word_A3 word_A4 9700e3ec4af85ae7546d52bb0aa15f4c42c1aed94ba5da9c18273b4e16751ef0 word_A6 word_A7
word_B1 word_B2 word_B3 word_B4 97b2728ca61a338db68c64ad13b9b51db338d27d00b56f98acc529b5ff4929e9 word_B6 word_B7
d2679e2780dab58874e4a07e17d3944c6c3fe4e0edeb0b1eed767a92bc60d2ef

Code:
word_01 word_02 word_03 word_04  word_06 word_07
word_11 word_12 word_13 word_14 81233e976f89c167d338d9a8cba97fb1e063b4c4514f06693a65c067c36afcdd word_16 word_17
word_21 word_22 word_23 word_24 28829970d9ac7c53e14a246c98fb11e9cb24f4c91a3b03cacf227144cd135334 word_26 word_27
word_31 word_32 word_33 word_34 5a85b70bc0a50d7fa9ad630652ded2e48a3716aa75438eaef7557312c01d7eb5 word_36 word_37
973568825cf106a3331aea7c42d05b2bdcbd4b4b2761e1efc9043ad5537485ccword_41 word_42 word_43 word_44  word_46 word_47
word_51 word_52 word_53 word_54 4fb3737155d728cf1efe4581e980707b40184bedc59eec9523848aa27d4e78b0 word_56 word_57
word_61 word_62 word_63 word_64 4b3a529aa0b718a93c8133647c8cb170887f86d2f10886a39154b88880421f8c word_66 word_67
word_71 word_72 word_73 word_74 14b325115cf1ac8d72920470fe9b6047b753bdd9b33738e856997a3dc29eaef1 word_76 word_77
word_81 word_82 word_83 word_84 d04ce42feb8e2804061d371e0c9c0dedb1f337ca21a33fe6020fcf1f288631d0 word_86 word_87
word_91 word_92 word_93 word_94 005373e5b47d5114156460f869db467bf5d54c89e5fd530a4c395f8eb7c485c1 word_96 word_97
word_A1 word_A2 word_A3 word_A4 9700e3ec4af85ae7546d52bb0aa15f4c42c1aed94ba5da9c18273b4e16751ef0 word_A6 word_A7
97b2728ca61a338db68c64ad13b9b51db338d27d00b56f98acc529b5ff4929e9word_B1 word_B2 word_B3 word_B4  word_B6 word_B7
d2679e2780dab58874e4a07e17d3944c6c3fe4e0edeb0b1eed767a92bc60d2ef


Last edited by Chubler_XL; 02-07-2018 at 04:36 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk: cannot open inputf

I'd like some help with awk too. Somewhere in my bash script i have written something like this: awk -v outputfile=$finalFile -v inputf=$file 'BEGIN { commands } { more commands } ΕND{ }' inputf where the file is a .input file with data. I also tried this: awk -v... (2 Replies)
Discussion started by: little_fairy
2 Replies

2. Shell Programming and Scripting

awk: can't open

Hi Guys, I was just trying to run a bunch of test scripts which ran perfectly before i changed servers to a different solaris machine. But i just changed it to run on a different solaris version and my awk statement in the script shows an error. awk BEGIN{s=ARGV; r=ARGV; \ ... (2 Replies)
Discussion started by: wick3dsunny
2 Replies

3. Shell Programming and Scripting

awk Can't open file

Hello all, I am creating a small bash script to cycle through some files that are the results of an analysis I have run (I am a statistician). There are many folders called job001, job002,...,job135. Each folder has a text file called results.txt. I want to create two summary files of the... (3 Replies)
Discussion started by: jem43
3 Replies

4. Shell Programming and Scripting

awk: can't open the file

I have a shell script with the following awk command. awk '$1 == "GEOG_SRV"{split($2,a,":");print a}' /etc/qm when I run it manually command line its fine and giving the output. bash-3.00$ awk '$1 == "GEOG_SRV"{split($2,a,":");print a}' /etc/qm 9010 But in the script its... (5 Replies)
Discussion started by: Tuxidow
5 Replies

5. Shell Programming and Scripting

How to open large datafie in awk?

I just tried awk '{print}' all.plo awk: cannot open all.plo (Value too large for defined data type)awk '{print $8"-"$7"-"$6,$9,$4,$5,$12,$15}' all.plo awk: cannot open all.plo (Value too large for defined data type) datafile size is 4.8GB any other provision ? only cat works FS is... (4 Replies)
Discussion started by: Akshay Hegde
4 Replies

6. Shell Programming and Scripting

Awk: can't open file!!

To whom it may concern, Please help! I am trying to use awk to open all the files in a folder and remove one row and append everything into an output file. for X in `ls /Users/misssmith/Desktop/birdseed/`; do awk '(NR==546412)' /Users/misssmith/Desktop/birdseed/$X >>... (6 Replies)
Discussion started by: salpie
6 Replies

7. Shell Programming and Scripting

Awk: can't open error

Hi , In a directory i've the files in the following format pay:year:mon:11789604 pay:year:mon:17675644 --- and i need to get 4th part of the above file name so i used awk command in the below code #!/bin/ksh for test_data in pay* do txt_awk = awk -F':' '{print $4;}' $test_data ... (7 Replies)
Discussion started by: smile689
7 Replies

8. Shell Programming and Scripting

awk throws makes too many open files

Hi, I have a below awk script. BEGIN { FS=","; } { system("curl -v -H \"Authorization: SSWS test" -H \"Accept: application/json\" -H \"Content-Type: application/json\" -X POST \"https://tes.test.com/api/v1/users?activate=false\" -d \'{ \"profile\": { \"firstName\": \"" $1 "... (7 Replies)
Discussion started by: Krrishv
7 Replies

9. Shell Programming and Scripting

awk output yields error: awk:can't open job_name (Autosys)

Good evening, Im newbie at unix specially with awk From an scheduler program called Autosys i want to extract some data reading an inputfile that comprises jobs names, then formating the output to columns for example 1. This is the inputfile: $ more MapaRep.txt ds_extra_nikira_usuarios... (18 Replies)
Discussion started by: alexcol
18 Replies

10. Shell Programming and Scripting

awk date too many open files

Dear Community; I have a csv file with msb and lsb in $3 and $5 fields which provides the epochtime (factor 65536). Further I need to convert epochtime to readable datetime. But am getting an error. File Sample: 5000a,1000,20671,0,16421,0,1,NULL,0 5000b,1000,20974,0,-16284,0,1,NULL,0... (4 Replies)
Discussion started by: mystition
4 Replies
All times are GMT -4. The time now is 07:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy