Sponsored Content
Full Discussion: commenting more then 1 line
Top Forums Shell Programming and Scripting commenting more then 1 line Post 302099842 by vino on Thursday 14th of December 2006 07:14:39 AM
Old 12-14-2006
Wrap the lines within :<<MARKER.. MARKER like shown below

Instead of MARKER you can use any string which is not used in your script. Preferably a unique string.

Code:
:<<COMMENT
a line in the script.
another line in the script
.
.
yet another line in script.
COMMENT

The above is the easiest thing to do. Else within vi you could issue
Code:
:10,20s/^/#/g

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Commenting lines

How to comment a set of lines in a script? we use # to comment a single line , is there ant other cmd to comment a block? (2 Replies)
Discussion started by: rolex.mp
2 Replies

2. Shell Programming and Scripting

Commenting

How can i comment multiple lines in unix ..............shell script. (6 Replies)
Discussion started by: dreams5617
6 Replies

3. Shell Programming and Scripting

Commenting a Line In a File

HI all I am working on a script, few details are as follows. I have one properties File and one script. The property file contains the JOBID which are to be executed and the Script runs these jobs ONE by ONE. After completing the JOB I need to comment that job in the property File. This is the... (3 Replies)
Discussion started by: Prashantckc
3 Replies

4. Shell Programming and Scripting

commenting

can we use "---------" for commenting......... (2 Replies)
Discussion started by: simmijaswal
2 Replies

5. Shell Programming and Scripting

Commenting contab from a script

Dear All, I have many cron entries and want to comment a particular cron entry from a script. Ex- Suppose I have the below cron entries: # DO NOT EDIT THIS FILE - edit the master and reinstall. #Cron entries for Jboss server 1 0 23 * * * /usr/bin/echo 0 23 * * * /usr/bin/asdg_count.sh 0 23 *... (5 Replies)
Discussion started by: avishek007
5 Replies

6. Shell Programming and Scripting

Commenting lines

Hi can any body pls help me : I have a file Which Content is like following: p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog 2<>/dev/msglog ca:3:respawn:/opt/GoldWing/currentPM/local/critagt > /dev/msglog 2<>/dev/msglog ca:3:respawn:/opt/GoldWing/currentPM/local/startcia.sh... (2 Replies)
Discussion started by: Aditya.Gurgaon
2 Replies

7. Shell Programming and Scripting

commenting out lines between two delimiters

Hi All, I am struggling to get my head around the following issue. I am having to comment out lines between two delimiters by placing an asterix in position 7 but retain all lines in the file and in the same order. so for example a file containing: ... ... DELIM1 ... ... DELIM2... (2 Replies)
Discussion started by: Bruble
2 Replies

8. UNIX for Dummies Questions & Answers

Commenting multiple lines

Hi, Can anyone let me know how to comment multiple lines in VI editor? Many thanks. Regards, Venkat. (3 Replies)
Discussion started by: venkatesht
3 Replies

9. Shell Programming and Scripting

Commenting a specific line and inserting a new line after commented line.

Hello All, I have following file contents cat file #line=aaaaaa #line=bbbbbb #line=cccccc #line=dddddd line=eeeeee #comment=11111 #comment=22222 #comment=33333 #comment=44444 comment=55555 Testing script Good Luck! I would like to comment line line=eeeeee and insert a new line... (19 Replies)
Discussion started by: manishdivs
19 Replies

10. UNIX for Dummies Questions & Answers

Commenting a line matched with a specific string in a file

Hi, I would like to comment a line that matched a string "sreenivas" in a file without opening it. Thanks in advance. Regards, Sreenivas (3 Replies)
Discussion started by: raosr020
3 Replies
IO::Wrap(3)						User Contributed Perl Documentation					       IO::Wrap(3)

NAME
IO::Wrap - wrap raw filehandles in IO::Handle interface SYNOPSIS
use IO::Wrap; ### Do stuff with any kind of filehandle (including a bare globref), or ### any kind of blessed object that responds to a print() message. ### sub do_stuff { my $fh = shift; ### At this point, we have no idea what the user gave us... ### a globref? a FileHandle? a scalar filehandle name? $fh = wraphandle($fh); ### At this point, we know we have an IO::Handle-like object! $fh->print("Hey there!"); ... } DESCRIPTION
Let's say you want to write some code which does I/O, but you don't want to force the caller to provide you with a FileHandle or IO::Handle object. You want them to be able to say: do_stuff(*STDOUT); do_stuff('STDERR'); do_stuff($some_FileHandle_object); do_stuff($some_IO_Handle_object); And even: do_stuff($any_object_with_a_print_method); Sure, one way to do it is to force the caller to use tiehandle(). But that puts the burden on them. Another way to do it is to use IO::Wrap, which provides you with the following functions: wraphandle SCALAR This function will take a single argument, and "wrap" it based on what it seems to be... o A raw scalar filehandle name, like "STDOUT" or "Class::HANDLE". In this case, the filehandle name is wrapped in an IO::Wrap object, which is returned. o A raw filehandle glob, like "*STDOUT". In this case, the filehandle glob is wrapped in an IO::Wrap object, which is returned. o A blessed FileHandle object. In this case, the FileHandle is wrapped in an IO::Wrap object if and only if your FileHandle class does not support the "read()" method. o Any other kind of blessed object, which is assumed to be already conformant to the IO::Handle interface. In this case, you just get back that object. If you get back an IO::Wrap object, it will obey a basic subset of the IO:: interface. That is, the following methods (note: I said methods, not named operators) should work on the thing you get back: close getline getlines print ARGS... read BUFFER,NBYTES seek POS,WHENCE tell NOTES
Clearly, when wrapping a raw external filehandle (like *STDOUT), I didn't want to close the file descriptor when the "wrapper" object is destroyed... since the user might not appreciate that! Hence, there's no DESTROY method in this class. When wrapping a FileHandle object, however, I believe that Perl will invoke the FileHandle::DESTROY when the last reference goes away, so in that case, the filehandle is closed if the wrapped FileHandle really was the last reference to it. WARNINGS
This module does not allow you to wrap filehandle names which are given as strings that lack the package they were opened in. That is, if a user opens FOO in package Foo, they must pass it to you either as "*FOO" or as "Foo::FOO". However, "STDIN" and friends will work just fine. VERSION
$Id: Wrap.pm,v 1.2 2005/02/10 21:21:53 dfs Exp $ AUTHOR
Primary Maintainer David F. Skoll (dfs@roaringpenguin.com). Original Author Eryq (eryq@zeegee.com). President, ZeeGee Software Inc (http://www.zeegee.com). POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 212: '=item' outside of any '=over' perl v5.12.1 2005-02-10 IO::Wrap(3)
All times are GMT -4. The time now is 10:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy