is a directory error

The name of the pictureThe name of the pictureThe name of the pictureClash 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









share|improve this question





















  • Why do you use $email but not set it to anything?
    – thrig
    Oct 10 '17 at 17:48














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









share|improve this question





















  • Why do you use $email but not set it to anything?
    – thrig
    Oct 10 '17 at 17:48












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









share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 10 '17 at 17:31









below_avg_st

84




84











  • 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















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










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.






share|improve this answer




















  • 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











  • @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










  • My teacher wants us to use only awk, sed, and bash in this practice example.
    – below_avg_st
    Oct 10 '17 at 19:34










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























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.






share|improve this answer




















  • 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











  • @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










  • My teacher wants us to use only awk, sed, and bash in this practice example.
    – below_avg_st
    Oct 10 '17 at 19:34














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.






share|improve this answer




















  • 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











  • @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










  • My teacher wants us to use only awk, sed, and bash in this practice example.
    – below_avg_st
    Oct 10 '17 at 19:34












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.






share|improve this answer












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.







share|improve this answer












share|improve this answer



share|improve this answer










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











  • @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










  • 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











  • 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 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















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

















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)