How do I resolve this sed error when I transfer the script from shell to Makefile?
up vote
0
down vote
favorite
So I have this makefile rule :
header:
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$$/;/' | sed '/int main/d' | sed '/inttmain' >> ./include/temp.txt
awk '//; /# define/while(getline<"header.h")print' temp.txt >tmp
mv tmp header.h
I am trying to create a lib project and I have a lot of functions in the ./srcs/ directory, each functions is stored in a ft_name_of_the_function directory. I want to have a Makefile rule that edit the header file of the lib (which is in ./include/ and called header.h) by adding each prototype.
This script was working as a shell executable but doesn't seem to work after I put this in the makefile. I can still tell the makefile to run a shell executable but I would like to understand. When I run make header
it gives me this standard output :
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$/;/' | sed '/int main/d' | sed '/inttmain' >> ./include/temp.txt
sed: -e expression n°1, caractère 10: expression régulière d'adresse inachevée
Makefile:41: recipe for target 'header' failed
make: *** [header] Error 1
sed makefile-errors
New contributor
add a comment |
up vote
0
down vote
favorite
So I have this makefile rule :
header:
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$$/;/' | sed '/int main/d' | sed '/inttmain' >> ./include/temp.txt
awk '//; /# define/while(getline<"header.h")print' temp.txt >tmp
mv tmp header.h
I am trying to create a lib project and I have a lot of functions in the ./srcs/ directory, each functions is stored in a ft_name_of_the_function directory. I want to have a Makefile rule that edit the header file of the lib (which is in ./include/ and called header.h) by adding each prototype.
This script was working as a shell executable but doesn't seem to work after I put this in the makefile. I can still tell the makefile to run a shell executable but I would like to understand. When I run make header
it gives me this standard output :
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$/;/' | sed '/int main/d' | sed '/inttmain' >> ./include/temp.txt
sed: -e expression n°1, caractère 10: expression régulière d'adresse inachevée
Makefile:41: recipe for target 'header' failed
make: *** [header] Error 1
sed makefile-errors
New contributor
You're welcome. :-)
– Tim
Nov 10 at 11:28
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
So I have this makefile rule :
header:
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$$/;/' | sed '/int main/d' | sed '/inttmain' >> ./include/temp.txt
awk '//; /# define/while(getline<"header.h")print' temp.txt >tmp
mv tmp header.h
I am trying to create a lib project and I have a lot of functions in the ./srcs/ directory, each functions is stored in a ft_name_of_the_function directory. I want to have a Makefile rule that edit the header file of the lib (which is in ./include/ and called header.h) by adding each prototype.
This script was working as a shell executable but doesn't seem to work after I put this in the makefile. I can still tell the makefile to run a shell executable but I would like to understand. When I run make header
it gives me this standard output :
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$/;/' | sed '/int main/d' | sed '/inttmain' >> ./include/temp.txt
sed: -e expression n°1, caractère 10: expression régulière d'adresse inachevée
Makefile:41: recipe for target 'header' failed
make: *** [header] Error 1
sed makefile-errors
New contributor
So I have this makefile rule :
header:
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$$/;/' | sed '/int main/d' | sed '/inttmain' >> ./include/temp.txt
awk '//; /# define/while(getline<"header.h")print' temp.txt >tmp
mv tmp header.h
I am trying to create a lib project and I have a lot of functions in the ./srcs/ directory, each functions is stored in a ft_name_of_the_function directory. I want to have a Makefile rule that edit the header file of the lib (which is in ./include/ and called header.h) by adding each prototype.
This script was working as a shell executable but doesn't seem to work after I put this in the makefile. I can still tell the makefile to run a shell executable but I would like to understand. When I run make header
it gives me this standard output :
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$/;/' | sed '/int main/d' | sed '/inttmain' >> ./include/temp.txt
sed: -e expression n°1, caractère 10: expression régulière d'adresse inachevée
Makefile:41: recipe for target 'header' failed
make: *** [header] Error 1
sed makefile-errors
sed makefile-errors
New contributor
New contributor
edited Nov 10 at 11:31
Tim
7,7082344
7,7082344
New contributor
asked Nov 10 at 11:13
nepriel
32
32
New contributor
New contributor
You're welcome. :-)
– Tim
Nov 10 at 11:28
add a comment |
You're welcome. :-)
– Tim
Nov 10 at 11:28
You're welcome. :-)
– Tim
Nov 10 at 11:28
You're welcome. :-)
– Tim
Nov 10 at 11:28
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
accepted
This sed command:
sed '/inttmain'
is not formed properly. You need an optional address (or addresses) and an action. If you run this at the command line you get this:
$ sed '/inttmain'
sed: -e expression #1, char 10: unterminated address regex
If you want it to be like the previous one:
sed '/int main/d'
but with a tab instead of a space, you probably want this:
sed '/inttmain/d'
You can combine these by using s+
to match some whitespace:
sed '/ints+main/d'
thanks ! I just figure out I forgot that :)
– nepriel
Nov 10 at 11:41
You're welcome. It happens to us all from time to time!
– Tim
Nov 10 at 11:45
add a comment |
up vote
0
down vote
I just figure out I did some other mistakes so in some case people are trying to do the same thing here is my final code :
cp ./include/initlibft.h ./include/libft.h
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$/;/' | sed '/main(/d' >> ./include/temp.txt
awk '//; /# define/while(getline<"./include/temp.txt")print' ./include/libft.h >tmp
mv tmp ./include/libft.h
New contributor
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
This sed command:
sed '/inttmain'
is not formed properly. You need an optional address (or addresses) and an action. If you run this at the command line you get this:
$ sed '/inttmain'
sed: -e expression #1, char 10: unterminated address regex
If you want it to be like the previous one:
sed '/int main/d'
but with a tab instead of a space, you probably want this:
sed '/inttmain/d'
You can combine these by using s+
to match some whitespace:
sed '/ints+main/d'
thanks ! I just figure out I forgot that :)
– nepriel
Nov 10 at 11:41
You're welcome. It happens to us all from time to time!
– Tim
Nov 10 at 11:45
add a comment |
up vote
0
down vote
accepted
This sed command:
sed '/inttmain'
is not formed properly. You need an optional address (or addresses) and an action. If you run this at the command line you get this:
$ sed '/inttmain'
sed: -e expression #1, char 10: unterminated address regex
If you want it to be like the previous one:
sed '/int main/d'
but with a tab instead of a space, you probably want this:
sed '/inttmain/d'
You can combine these by using s+
to match some whitespace:
sed '/ints+main/d'
thanks ! I just figure out I forgot that :)
– nepriel
Nov 10 at 11:41
You're welcome. It happens to us all from time to time!
– Tim
Nov 10 at 11:45
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
This sed command:
sed '/inttmain'
is not formed properly. You need an optional address (or addresses) and an action. If you run this at the command line you get this:
$ sed '/inttmain'
sed: -e expression #1, char 10: unterminated address regex
If you want it to be like the previous one:
sed '/int main/d'
but with a tab instead of a space, you probably want this:
sed '/inttmain/d'
You can combine these by using s+
to match some whitespace:
sed '/ints+main/d'
This sed command:
sed '/inttmain'
is not formed properly. You need an optional address (or addresses) and an action. If you run this at the command line you get this:
$ sed '/inttmain'
sed: -e expression #1, char 10: unterminated address regex
If you want it to be like the previous one:
sed '/int main/d'
but with a tab instead of a space, you probably want this:
sed '/inttmain/d'
You can combine these by using s+
to match some whitespace:
sed '/ints+main/d'
answered Nov 10 at 11:22
Tim
7,7082344
7,7082344
thanks ! I just figure out I forgot that :)
– nepriel
Nov 10 at 11:41
You're welcome. It happens to us all from time to time!
– Tim
Nov 10 at 11:45
add a comment |
thanks ! I just figure out I forgot that :)
– nepriel
Nov 10 at 11:41
You're welcome. It happens to us all from time to time!
– Tim
Nov 10 at 11:45
thanks ! I just figure out I forgot that :)
– nepriel
Nov 10 at 11:41
thanks ! I just figure out I forgot that :)
– nepriel
Nov 10 at 11:41
You're welcome. It happens to us all from time to time!
– Tim
Nov 10 at 11:45
You're welcome. It happens to us all from time to time!
– Tim
Nov 10 at 11:45
add a comment |
up vote
0
down vote
I just figure out I did some other mistakes so in some case people are trying to do the same thing here is my final code :
cp ./include/initlibft.h ./include/libft.h
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$/;/' | sed '/main(/d' >> ./include/temp.txt
awk '//; /# define/while(getline<"./include/temp.txt")print' ./include/libft.h >tmp
mv tmp ./include/libft.h
New contributor
add a comment |
up vote
0
down vote
I just figure out I did some other mistakes so in some case people are trying to do the same thing here is my final code :
cp ./include/initlibft.h ./include/libft.h
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$/;/' | sed '/main(/d' >> ./include/temp.txt
awk '//; /# define/while(getline<"./include/temp.txt")print' ./include/libft.h >tmp
mv tmp ./include/libft.h
New contributor
add a comment |
up vote
0
down vote
up vote
0
down vote
I just figure out I did some other mistakes so in some case people are trying to do the same thing here is my final code :
cp ./include/initlibft.h ./include/libft.h
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$/;/' | sed '/main(/d' >> ./include/temp.txt
awk '//; /# define/while(getline<"./include/temp.txt")print' ./include/libft.h >tmp
mv tmp ./include/libft.h
New contributor
I just figure out I did some other mistakes so in some case people are trying to do the same thing here is my final code :
cp ./include/initlibft.h ./include/libft.h
rm -f ./include/temp.txt
cat ./srcs/ft_*/ft_*.c | grep -E "^w" | sed 's/$/;/' | sed '/main(/d' >> ./include/temp.txt
awk '//; /# define/while(getline<"./include/temp.txt")print' ./include/libft.h >tmp
mv tmp ./include/libft.h
New contributor
New contributor
answered Nov 10 at 12:18
nepriel
32
32
New contributor
New contributor
add a comment |
add a comment |
nepriel is a new contributor. Be nice, and check out our Code of Conduct.
nepriel is a new contributor. Be nice, and check out our Code of Conduct.
nepriel is a new contributor. Be nice, and check out our Code of Conduct.
nepriel is a new contributor. Be nice, and check out our Code of Conduct.
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%2fstackoverflow.com%2fquestions%2f53238375%2fhow-do-i-resolve-this-sed-error-when-i-transfer-the-script-from-shell-to-makefil%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
You're welcome. :-)
– Tim
Nov 10 at 11:28