is a directory error

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm having some problems running my current program. I need to take a file of customers information (each line is a new customer) and substitute it into a template. Each customer info will created a file from the template and will be named using the customer's email and placed into the Email subdirectory using awk and sed. Right now my program is not 'doing anything' except printing the line ./test.bash: line 19: Emails/: Is a directory .
1 #!/bin/bash
2 set -e
3
4 if [ "$#" -ne 1 ]; then
5 echo "Illegal number of parameters. Usage:./test1.bash <mm/dd/yyyy>"
6 exit 1
7 fi
8
9 OUTPUT_DIR="Emails"
10 details="p4Customer.txt"
11 template="template.txt"
12 date=$1
13 if [ ! -d "$OUTPUT_DIR" ]; then
14 mkdir -p "$OUTPUT_DIR"
15 fi
16
17 gawk -f g2.awk -v date="$date" "$details" | while read detail;
18 do
19 sed "$detail" "$template" > "$OUTPUT_DIR/$email"
20 done;
awk file
1 BEGIN FS=",";
2
3 email=$1;
4 fullname=$2;
5 title=$3;
6 n=split(fullname,A," ");
7 name=A[n];
8 amount_owed=$5;
9 if($5>$4)
10 printf "s/EMAIL/%s/;s/FULLNAME/%s/;s/TITLE/%s/;s/NAME/%s/;s/AMOUNT/%s/;s/DATE/%s/n", email, fullname, title, name, amount_owed, date;
11
12 END
sed directory gawk
add a comment |Â
up vote
0
down vote
favorite
I'm having some problems running my current program. I need to take a file of customers information (each line is a new customer) and substitute it into a template. Each customer info will created a file from the template and will be named using the customer's email and placed into the Email subdirectory using awk and sed. Right now my program is not 'doing anything' except printing the line ./test.bash: line 19: Emails/: Is a directory .
1 #!/bin/bash
2 set -e
3
4 if [ "$#" -ne 1 ]; then
5 echo "Illegal number of parameters. Usage:./test1.bash <mm/dd/yyyy>"
6 exit 1
7 fi
8
9 OUTPUT_DIR="Emails"
10 details="p4Customer.txt"
11 template="template.txt"
12 date=$1
13 if [ ! -d "$OUTPUT_DIR" ]; then
14 mkdir -p "$OUTPUT_DIR"
15 fi
16
17 gawk -f g2.awk -v date="$date" "$details" | while read detail;
18 do
19 sed "$detail" "$template" > "$OUTPUT_DIR/$email"
20 done;
awk file
1 BEGIN FS=",";
2
3 email=$1;
4 fullname=$2;
5 title=$3;
6 n=split(fullname,A," ");
7 name=A[n];
8 amount_owed=$5;
9 if($5>$4)
10 printf "s/EMAIL/%s/;s/FULLNAME/%s/;s/TITLE/%s/;s/NAME/%s/;s/AMOUNT/%s/;s/DATE/%s/n", email, fullname, title, name, amount_owed, date;
11
12 END
sed directory gawk
Why do you use$emailbut not set it to anything?
â thrig
Oct 10 '17 at 17:48
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm having some problems running my current program. I need to take a file of customers information (each line is a new customer) and substitute it into a template. Each customer info will created a file from the template and will be named using the customer's email and placed into the Email subdirectory using awk and sed. Right now my program is not 'doing anything' except printing the line ./test.bash: line 19: Emails/: Is a directory .
1 #!/bin/bash
2 set -e
3
4 if [ "$#" -ne 1 ]; then
5 echo "Illegal number of parameters. Usage:./test1.bash <mm/dd/yyyy>"
6 exit 1
7 fi
8
9 OUTPUT_DIR="Emails"
10 details="p4Customer.txt"
11 template="template.txt"
12 date=$1
13 if [ ! -d "$OUTPUT_DIR" ]; then
14 mkdir -p "$OUTPUT_DIR"
15 fi
16
17 gawk -f g2.awk -v date="$date" "$details" | while read detail;
18 do
19 sed "$detail" "$template" > "$OUTPUT_DIR/$email"
20 done;
awk file
1 BEGIN FS=",";
2
3 email=$1;
4 fullname=$2;
5 title=$3;
6 n=split(fullname,A," ");
7 name=A[n];
8 amount_owed=$5;
9 if($5>$4)
10 printf "s/EMAIL/%s/;s/FULLNAME/%s/;s/TITLE/%s/;s/NAME/%s/;s/AMOUNT/%s/;s/DATE/%s/n", email, fullname, title, name, amount_owed, date;
11
12 END
sed directory gawk
I'm having some problems running my current program. I need to take a file of customers information (each line is a new customer) and substitute it into a template. Each customer info will created a file from the template and will be named using the customer's email and placed into the Email subdirectory using awk and sed. Right now my program is not 'doing anything' except printing the line ./test.bash: line 19: Emails/: Is a directory .
1 #!/bin/bash
2 set -e
3
4 if [ "$#" -ne 1 ]; then
5 echo "Illegal number of parameters. Usage:./test1.bash <mm/dd/yyyy>"
6 exit 1
7 fi
8
9 OUTPUT_DIR="Emails"
10 details="p4Customer.txt"
11 template="template.txt"
12 date=$1
13 if [ ! -d "$OUTPUT_DIR" ]; then
14 mkdir -p "$OUTPUT_DIR"
15 fi
16
17 gawk -f g2.awk -v date="$date" "$details" | while read detail;
18 do
19 sed "$detail" "$template" > "$OUTPUT_DIR/$email"
20 done;
awk file
1 BEGIN FS=",";
2
3 email=$1;
4 fullname=$2;
5 title=$3;
6 n=split(fullname,A," ");
7 name=A[n];
8 amount_owed=$5;
9 if($5>$4)
10 printf "s/EMAIL/%s/;s/FULLNAME/%s/;s/TITLE/%s/;s/NAME/%s/;s/AMOUNT/%s/;s/DATE/%s/n", email, fullname, title, name, amount_owed, date;
11
12 END
sed directory gawk
sed directory gawk
asked Oct 10 '17 at 17:31
below_avg_st
84
84
Why do you use$emailbut not set it to anything?
â thrig
Oct 10 '17 at 17:48
add a comment |Â
Why do you use$emailbut not set it to anything?
â thrig
Oct 10 '17 at 17:48
Why do you use
$email but not set it to anything?â thrig
Oct 10 '17 at 17:48
Why do you use
$email but not set it to anything?â thrig
Oct 10 '17 at 17:48
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
The line
sed "$detail" "$template" > "$OUTPUT_DIR/$email"
uses the parameter email which is defined for awk only what does not affect the shell environment.
I see what you mean about the shell environment variables. Since Im usingawkto set the variables and to create asedfile, is there anyway I could get the customers email from the file while doing that, or would I maybe have to run a read loop on the file at the same time also to get each individual customers email were the>"OUTPUT_DIR/$email"is? @Hauke Laging
â below_avg_st
Oct 10 '17 at 18:01
Perhaps a newawkcommand to print the email or agrepcommand?
â below_avg_st
Oct 10 '17 at 18:09
@below_avg_st what you probably are looking for here issource: ss64.com/bash/source.html This runs the file in the shell that called thesourcecommand as opposed to a subshell. A benefit of this is that if you have a file that just sets variables, you can usesourceto pull them all into a different shell.
â Thegs
Oct 10 '17 at 18:11
@below_avg_st Why would you useawkat all in order to generatesedcommands?awkis the mightier tool and can do thesedwork.
â Hauke Laging
Oct 10 '17 at 19:32
My teacher wants us to use only awk, sed, and bash in this practice example.
â below_avg_st
Oct 10 '17 at 19:34
 |Â
show 3 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
The line
sed "$detail" "$template" > "$OUTPUT_DIR/$email"
uses the parameter email which is defined for awk only what does not affect the shell environment.
I see what you mean about the shell environment variables. Since Im usingawkto set the variables and to create asedfile, is there anyway I could get the customers email from the file while doing that, or would I maybe have to run a read loop on the file at the same time also to get each individual customers email were the>"OUTPUT_DIR/$email"is? @Hauke Laging
â below_avg_st
Oct 10 '17 at 18:01
Perhaps a newawkcommand to print the email or agrepcommand?
â below_avg_st
Oct 10 '17 at 18:09
@below_avg_st what you probably are looking for here issource: ss64.com/bash/source.html This runs the file in the shell that called thesourcecommand as opposed to a subshell. A benefit of this is that if you have a file that just sets variables, you can usesourceto pull them all into a different shell.
â Thegs
Oct 10 '17 at 18:11
@below_avg_st Why would you useawkat all in order to generatesedcommands?awkis the mightier tool and can do thesedwork.
â Hauke Laging
Oct 10 '17 at 19:32
My teacher wants us to use only awk, sed, and bash in this practice example.
â below_avg_st
Oct 10 '17 at 19:34
 |Â
show 3 more comments
up vote
2
down vote
accepted
The line
sed "$detail" "$template" > "$OUTPUT_DIR/$email"
uses the parameter email which is defined for awk only what does not affect the shell environment.
I see what you mean about the shell environment variables. Since Im usingawkto set the variables and to create asedfile, is there anyway I could get the customers email from the file while doing that, or would I maybe have to run a read loop on the file at the same time also to get each individual customers email were the>"OUTPUT_DIR/$email"is? @Hauke Laging
â below_avg_st
Oct 10 '17 at 18:01
Perhaps a newawkcommand to print the email or agrepcommand?
â below_avg_st
Oct 10 '17 at 18:09
@below_avg_st what you probably are looking for here issource: ss64.com/bash/source.html This runs the file in the shell that called thesourcecommand as opposed to a subshell. A benefit of this is that if you have a file that just sets variables, you can usesourceto pull them all into a different shell.
â Thegs
Oct 10 '17 at 18:11
@below_avg_st Why would you useawkat all in order to generatesedcommands?awkis the mightier tool and can do thesedwork.
â Hauke Laging
Oct 10 '17 at 19:32
My teacher wants us to use only awk, sed, and bash in this practice example.
â below_avg_st
Oct 10 '17 at 19:34
 |Â
show 3 more comments
up vote
2
down vote
accepted
up vote
2
down vote
accepted
The line
sed "$detail" "$template" > "$OUTPUT_DIR/$email"
uses the parameter email which is defined for awk only what does not affect the shell environment.
The line
sed "$detail" "$template" > "$OUTPUT_DIR/$email"
uses the parameter email which is defined for awk only what does not affect the shell environment.
answered Oct 10 '17 at 17:53
Hauke Laging
53.7k1282130
53.7k1282130
I see what you mean about the shell environment variables. Since Im usingawkto set the variables and to create asedfile, is there anyway I could get the customers email from the file while doing that, or would I maybe have to run a read loop on the file at the same time also to get each individual customers email were the>"OUTPUT_DIR/$email"is? @Hauke Laging
â below_avg_st
Oct 10 '17 at 18:01
Perhaps a newawkcommand to print the email or agrepcommand?
â below_avg_st
Oct 10 '17 at 18:09
@below_avg_st what you probably are looking for here issource: ss64.com/bash/source.html This runs the file in the shell that called thesourcecommand as opposed to a subshell. A benefit of this is that if you have a file that just sets variables, you can usesourceto pull them all into a different shell.
â Thegs
Oct 10 '17 at 18:11
@below_avg_st Why would you useawkat all in order to generatesedcommands?awkis the mightier tool and can do thesedwork.
â Hauke Laging
Oct 10 '17 at 19:32
My teacher wants us to use only awk, sed, and bash in this practice example.
â below_avg_st
Oct 10 '17 at 19:34
 |Â
show 3 more comments
I see what you mean about the shell environment variables. Since Im usingawkto set the variables and to create asedfile, is there anyway I could get the customers email from the file while doing that, or would I maybe have to run a read loop on the file at the same time also to get each individual customers email were the>"OUTPUT_DIR/$email"is? @Hauke Laging
â below_avg_st
Oct 10 '17 at 18:01
Perhaps a newawkcommand to print the email or agrepcommand?
â below_avg_st
Oct 10 '17 at 18:09
@below_avg_st what you probably are looking for here issource: ss64.com/bash/source.html This runs the file in the shell that called thesourcecommand as opposed to a subshell. A benefit of this is that if you have a file that just sets variables, you can usesourceto pull them all into a different shell.
â Thegs
Oct 10 '17 at 18:11
@below_avg_st Why would you useawkat all in order to generatesedcommands?awkis the mightier tool and can do thesedwork.
â Hauke Laging
Oct 10 '17 at 19:32
My teacher wants us to use only awk, sed, and bash in this practice example.
â below_avg_st
Oct 10 '17 at 19:34
I see what you mean about the shell environment variables. Since Im using
awk to set the variables and to create a sed file, is there anyway I could get the customers email from the file while doing that, or would I maybe have to run a read loop on the file at the same time also to get each individual customers email were the >"OUTPUT_DIR/$email" is? @Hauke Lagingâ below_avg_st
Oct 10 '17 at 18:01
I see what you mean about the shell environment variables. Since Im using
awk to set the variables and to create a sed file, is there anyway I could get the customers email from the file while doing that, or would I maybe have to run a read loop on the file at the same time also to get each individual customers email were the >"OUTPUT_DIR/$email" is? @Hauke Lagingâ below_avg_st
Oct 10 '17 at 18:01
Perhaps a new
awk command to print the email or a grep command?â below_avg_st
Oct 10 '17 at 18:09
Perhaps a new
awk command to print the email or a grep command?â below_avg_st
Oct 10 '17 at 18:09
@below_avg_st what you probably are looking for here is
source: ss64.com/bash/source.html This runs the file in the shell that called the source command as opposed to a subshell. A benefit of this is that if you have a file that just sets variables, you can use source to pull them all into a different shell.â Thegs
Oct 10 '17 at 18:11
@below_avg_st what you probably are looking for here is
source: ss64.com/bash/source.html This runs the file in the shell that called the source command as opposed to a subshell. A benefit of this is that if you have a file that just sets variables, you can use source to pull them all into a different shell.â Thegs
Oct 10 '17 at 18:11
@below_avg_st Why would you use
awk at all in order to generate sed commands? awk is the mightier tool and can do the sed work.â Hauke Laging
Oct 10 '17 at 19:32
@below_avg_st Why would you use
awk at all in order to generate sed commands? awk is the mightier tool and can do the sed work.â Hauke Laging
Oct 10 '17 at 19:32
My teacher wants us to use only awk, sed, and bash in this practice example.
â below_avg_st
Oct 10 '17 at 19:34
My teacher wants us to use only awk, sed, and bash in this practice example.
â below_avg_st
Oct 10 '17 at 19:34
 |Â
show 3 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397272%2fis-a-directory-error%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Why do you use
$emailbut not set it to anything?â thrig
Oct 10 '17 at 17:48