I have a file curve.csv which is generated from oracle and each line has a comment associated with it, I want to get rid of this comment, can you please suggest me a command as how to do it
Eg,
cat curve.csv
/*data for today curve*/
/*data for text1*/ this is the header
/*data for text2*/ this is the body
the output that I want it
cat curve.csv
this is the header
this is the body
there is no requirement for comment, can you please suggest?
Thanks
(Note I have not bothered to remove the leading newline as that is easy.)
#!/bin/bash
> /tmp/comment
> /tmp/nocomments
ifs_str="$IFS"
IFS="/"$'\n'
echo '/*data for today curve*/
/*data for text1*/ this is the header
/*data for text2*/ this is the body' >> /tmp/comment
while read line
do
text=($line)
echo "${text[2]:1}" >> /tmp/nocomments
done < /tmp/comment
cat < /tmp/nocomments
IFS="$ifs_str"
exit 0
Resuilts:-
AMIGA:~> cd /tmp
AMIGA:/tmp> chmod 755 comment.sh
AMIGA:/tmp> ./comment.sh
this is the header
this is the body
AMIGA:/tmp> _
The trouble with these C-Style comments is that they can span multiple lines and that if the comment characters are embedded in quotation marks then they should not be regarded as comments.
Problem with this code is, its deleting the line if its finding the comment on right side of the file, I am in need to remove only /<any text number etc>/
this is not working if the line is
this is the first line /*print first line*/
---------- Post updated at 07:32 PM ---------- Previous update was at 07:31 PM ----------