Sponsored Content
Full Discussion: print only comments
Top Forums Shell Programming and Scripting print only comments Post 302429147 by Mark_orig on Sunday 13th of June 2010 05:57:13 AM
Old 06-13-2010
Thank you for the answer, but I want something defferent (no Perl) , like this:
Code:
#!/bin/sh

if [ -f  $1 ]; then
echo " file $1 exists"
else
echo "file $1 does not exists"
fi
exit 1

#  but I want to check if file is .java or .c++ not a simple file (-f), I don't know how to do it..
# if all are ok I call awk

BEGIN awk'

regular expression for comments /*...*/, //.

END{print comments}'

 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remove comments...

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)
Discussion started by: LivinFree
1 Replies

2. UNIX for Dummies Questions & Answers

Print comments in FTP

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)
Discussion started by: lweegp
7 Replies

3. Shell Programming and Scripting

Comments unexpectedly print

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)
Discussion started by: John H
5 Replies

4. Programming

lint comments

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)
Discussion started by: axes
5 Replies

5. Shell Programming and Scripting

Scripting comments

Anyone have a good link for documentation conventions for scripts? (4 Replies)
Discussion started by: gliesian
4 Replies

6. Shell Programming and Scripting

delete comments

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)
Discussion started by: susau_79
10 Replies

7. Shell Programming and Scripting

Sed script, changing all C-comments to C++-comments

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)
Discussion started by: black_hawk
2 Replies

8. UNIX for Dummies Questions & Answers

Delete Comments

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)
Discussion started by: eightball
7 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 06:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy