I want to write a shell script which it takes as argument a java file or a c++ file (.java or .cpp).
It will check if the file is type of java or c++, else it ends with error message.
If all are ok, it will call awk that prints only the comments that the java or c++ file contains, grouping and puting them between tags.
For example, I have this code:
I want to have this output:
---------- Post updated at 02:21 ---------- Previous update was at 02:17 ----------
Let me know if this Perl script is an option for you, if yes, I could add file type checking of the argument (file name).
Aiiyeh, I see you want them grouped too ... (that should also be no problem: simply creating 2 (or 3) arrays for 2 (or 3) types of comments)
Last edited by pseudocoder; 06-12-2010 at 09:28 PM..
Yeah, because I (apart from the Perl script) only helped you to solve this problem: # but I want to check if file is .java or .c++ not a simple file (-f), I don't know how to do it..
The part with awk and regex (the hardest part IMHO) is still open.
This User Gave Thanks to pseudocoder For This Post:
Hello i am back :D,
i have a prolem. I want to Delete the IPs which are in Comments.
Input
192.168.0.1
192.168.0.2
#192.168.0.3
#192.168.0.4 - when TAB or Space, delete too.
/*192.168.0.5
192.168.0.6
192.168.0.7*\
Output
192.168.0.1
192.168.0.2
My solution is sed -e... (7 Replies)
I must write a script to change all C++ like comments:
// this is a comment
to this one
/* this is a comment */
How to do it by sed? With file:
#include <cstdio>
using namespace std; //one
// two
int main() {
printf("Example"); // three
}//four
the result should be: (2 Replies)
Delete everything comes in between /* & */.
Current File:
====================
create or replace procedure test421
is
begin
/*
---sasasas/*dsdsds
*/
dbms_output.put_line('SAURABH');
END;
To be File:
===================
create or replace procedure test421
is
begin... (10 Replies)
Hi
can anyone help me regarding the meaning of the following lint messages.
what is the use of having such lint comments in the c program.
/*lint -esym(534,cputs,fgets,cprintf) */
/*lint -efile(766,pragmas.h) */
Thanks a lot in advance. (5 Replies)
Hi All,
I am working on a sh script.
Half way through the script, my comments start to print to screen as if I used echo.
Obviously any comments are preceded with a #.
And I have not used set -x or anything similar.
Can anyone free me of this simple but annoying problem?
Thanks
John (5 Replies)
Dear Unix Gurus,
Not sure if this is possible/workable but I'm trying add a comment line before each operation such as the following:
ftp -n <mail server> ${log_dir}/test_put.log << END
user <user_id> <password>
verbose
bin
# List Files Before putting Data
echo File Check Before FTP >>... (7 Replies)
It may be a no-brainer, but the answer is escaping me right now:
I'm trying to write a little script to remove all comments from .c source... I was thinking sed, but I'm not a very strong regexp user (e.g. I suck with sed).
I tried dumping the file into:
sed -e 's/\/\* * \*\///g'
and several... (1 Reply)