Sponsored Content
Top Forums Shell Programming and Scripting Create a file with comment in script Post 302768697 by Scrutinizer on Saturday 9th of February 2013 07:22:16 AM
Old 02-09-2013
It is really unclear what is required. Is the list_file variable or the output file?
You could try something like this and adjust as required...

Code:
f1() {
  :                             # put your function here
} 

[ $# -eq 1 ] || exit 1          # exit when no file provided
outfile=$1                      # this is the file that the user provides on the command line

while read line; do
  case $line in               
    \#*) echo "$line"           # Skip the comment
         ;;
      *) set -- $line           # split $line into positional parameters
         f1 "$@"                # call f1 with the positional parameters
         ;;
  esac
done < list_file > "$outfile"   # read from list_file, write to $outfile


Last edited by Scrutinizer; 02-09-2013 at 08:28 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Block Comment in Shell script

how to put multiline comments in a shell script like /* Some code */ in C language? (3 Replies)
Discussion started by: skyineyes
3 Replies

2. Shell Programming and Scripting

Pls comment on my script.

Hi guys, hope you scripting gurus here can help me out, the logic in my script somehow not working the way it should, this script part of a bigger backup script suppose to do some checking on the cluster prior to bringing up the package on MC/SG after backend cloning operation, this portion is... (3 Replies)
Discussion started by: sparcguy
3 Replies

3. UNIX for Dummies Questions & Answers

Why do a unix script starts with a comment?

For eg: #!/usr/bin/ksh <remaining code goes here> .. .. Does the compiler ignores that? Thanks (2 Replies)
Discussion started by: ajincoep
2 Replies

4. Shell Programming and Scripting

Script to put block comment after finding regex in xml file

hi, i need my bash script to find regex in xml file.. and comment 2 lines before and after the line that contains regex.. can't use # needs to be <!-- at the beginning and --> and the end of the comment. so eg.. first block <filter> <filter-name>MyRegEx</filter-name> ... (11 Replies)
Discussion started by: Poki
11 Replies

5. UNIX for Dummies Questions & Answers

multiline comment in shell script

Is thery any way to give comment to multiple line without explicitly specifying # at the begining of each line ? (2 Replies)
Discussion started by: hiten.r.chauhan
2 Replies

6. Shell Programming and Scripting

Need to comment some code via script

Hi, I am writing a shell script, which should comment a if-fi loop in a file. From google i found that, we can use below qualifier to comment a section of code, :<<COMMENT COMMENT But i could not place these keywords before and after if-fi loop. Any help would be appreciated. Finally the... (2 Replies)
Discussion started by: successlin
2 Replies

7. Shell Programming and Scripting

Create shell script to extract unique information from one file to a new file.

Hi to all, I got this content/pattern from file http.log.20110808.gz mail1 httpd: Account Notice: close igchung@abc.com 2011/8/7 7:37:36 0:00:03 0 0 1 mail1 httpd: Account Information: login sastria9@abc.com proxy sid=gFp4DLm5HnU mail1 httpd: Account Notice: close sastria9@abc.com... (16 Replies)
Discussion started by: Mr_47
16 Replies

8. Shell Programming and Scripting

sed/awk script to replace only FIRST comment in the file

My first comment on every file contains the license message. I want to replace with a new license message. I used the below sed script, which replaces all comments. What is the modification or any other method with awk script for the below to edit only the first comment(license message)? #sed -f... (1 Reply)
Discussion started by: vpshastry
1 Replies

9. Shell Programming and Scripting

Shell Script Comment code blocks in a bash source file

Just began to learn on Shell Script. I got an exercise from my friend. I know how to make this happen in C, but I'm not familiar with Shell Script. Hope I can get some help from all of you. I want to write a bash script to comment code blocks in a bash source file. What I mean comment is '#', I... (1 Reply)
Discussion started by: HiFuture0801
1 Replies

10. UNIX for Beginners Questions & Answers

Remove Comment Lines From Script/Input File

Hello, I have a SAS code that predominantly has comments line and the real code like below and i want to remove ONLY THE COMMENTS from the code in the single line or spanned across multiple lines. /******************************************************************** *** This Is a Comment... (4 Replies)
Discussion started by: arooonatr
4 Replies
qmp3join(1)							 quelcom man pages						       qmp3join(1)

NAME
qmp3join - join mp3 files SYNOPSIS
qmp3join [option]... file1 file2... DESCRIPTION
qmp3join reads a list of mp3 files and joins them in one mp3 file in the specified order. some conditions must be met for the parameters of each of the files (see NOTES section). OPTIONS
-f, --force force join bypassing bit rate checks. by default, to join two files they must be both vbr (have variable bit rate) or have the same bit rate. using this option you can skip this check. -h, --help show a brief help and exit. -o <outfile>, --output=<outfile> outfile is the name of the file where all the frames will be copied. if this option is not used, the frames from the second to the last file of the list will be appended to file1. -v, --verbose show which operations are done. -V, --version show version and exit. NOTES
(all) the following parameters are required to be common for two mp3 files to be joined: [fill this!!!]. also, about the bit rate parame- ter, both mp3 must have the same value or (both) must have a variable bit rate. this restriction would be by-passable with the --force flag. before joining, all the streams are tested for validity. this is a time consuming operation. in any case, qmp3join can be viewed like a better but restrictive cat for mp3 files, due to the mp3 file format characteristics. BUGS
tests have been done only with mpeg version 1 layer iii streams, though it may (or not) work with other versions/layers. AUTHOR
dmanye@etse.urv.es http://www.etse.urv.es/~dmanye/quelcom/quelcom.html SEE ALSO
qmp3info(1), qmp3cut(1), qmp3check(1), qmp3report(1) qwavinfo(1), qwavjoin(1), qwavcut(1), qwavsilence(1), qwavfade(1), qwavheaderdump(1) quelcom 0.4.0 february 2001 qmp3join(1)
All times are GMT -4. The time now is 01:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy