Sponsored Content
Top Forums Shell Programming and Scripting awk throws makes too many open files Post 302913624 by Krrishv on Tuesday 19th of August 2014 02:18:45 AM
Old 08-19-2014
awk throws makes too many open files

Hi,

I have a below awk script.
Code:
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 " \",  \"lastName\": \"" $2" \",  \"email\": \"" $3 "\", \"login\": \"" $4 "\" } }\'"| getline response);

  #Printing the create user response
  system("echo " response);

#get the UID from the response for adding to the group
system("echo " response "| cut -d' ' -f1 | cut -d':' -f2" | getline id);


#Add the created user to group from csv file
        system("curl -H \"Authorization: SSWS test" -H \"Accept: application/json\" -H \"Content-Type: application/json\" -X PUT \"https://test.test.com/api/v1/groups/00g2msc01fEYNMEAXNMZ/users/" id "\"");

}

when i execute the command in my mac os
Code:
awk -f Finaluser.awk test1.csv

it creates 8 users fine in the 9th user i get a below error.
Code:
awk: echo {"id":"00u2mut1cf","status":"STAGED","created":"2014-08-19T06:03:52.000Z","activated":null,"statusChanged":null,"lastLogin":null,"lastUpdated":"2014-08-19T06:03:52.000Z","passwordChanged":null,"profile":{"firstName":"Adam ","lastName":"test ","email":"test.adam@2l.test","login":"test.adam@2l.test","mobilePhone":null},"credentials":{"provider":{"type":"TEST","name":"TEST"}},"_links":{"activate":{"href":"https://test.test.com/api/v1/users/00u2mut1cf/lifecycle/activate","method":"POST"},"deactivate":{"href":"https://test.test.com/api/v1/users/00u2mut1cf/lifecycle/deactivate","method":"POST"}}}| cut -d' ' -f1 | cut -d':' -f2 makes too many open files
 input record number 9, file test1.csv

Please throw some light on this.

Last edited by Franklin52; 08-19-2014 at 03:28 AM.. Reason: Please use code tags
 

7 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Search throws a wobbly

Dear Administrator, Rule No.5 for unregistered users is impossible to comply with because Google search thinks that any Unix command that I search for is an attack from a virus and blocks the search. I managed to find this site from an external search, and it looks really useful. Do you... (2 Replies)
Discussion started by: Ken N
2 Replies

2. UNIX for Dummies Questions & Answers

scp throws error

My script is like STAMP=$(perl -e '($ss, $mm, $hh, $DD, $MM, $YY) = localtime(time() - 100); printf "%04d%02d%02d%02d%02d", $YY + 1900, $MM + 1, $DD, $hh, $mm') touch $STAMP /sasdata/copydata/ find /sasdata/copydata -type f ! -newer /sasdata/copydata/ -print > output3.txt awk '{print "scp ... (6 Replies)
Discussion started by: tushar_spatil
6 Replies

3. Shell Programming and Scripting

awk script throws invalid char expression

Hello there, I am new to the awk scripting and getting the following error while running the script. Please can you advise me how to resolve this . Thanks ./sub_del_awk_lat.sh awk: cmd. line:5: warning: escape sequence `\/' treated as plain `/' awk: cmd. line:5: sed -n... (6 Replies)
Discussion started by: Sudhakar333
6 Replies

4. Shell Programming and Scripting

Calling shell script within awk script throws error

I am getting the following error while passing parameter to a shell script called within awk script. Any idea what's causing this issue and how to ix it ? Thanks sh: -c: line 0: syntax error near unexpected token `newline' sh: -c: line 0: `./billdatecalc.sh ... (10 Replies)
Discussion started by: Sudhakar333
10 Replies

5. 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

6. 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

7. Shell Programming and Scripting

awk (Too many open files)

Hi Team, This is my first post, hope I am doing it right. I have a large file, like 6 GB. Its a proxy file so vendor requested to change username from logs for saving the confidentiality of the user. This is the script I created (With the help of Google): awk '{ tmp="echo " $5 " |... (12 Replies)
Discussion started by: tealc
12 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 12:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy