Sponsored Content
Top Forums Shell Programming and Scripting How can i comment out a section between two particular lines Post 302598542 by jim mcnamara on Tuesday 14th of February 2012 08:23:19 PM
Old 02-14-2012
I am using the # character at the begining of the line. change it to reflect your idea of commenting out.
Code:
awk ' BEGIN{ ok=0 }
        /BEGIN e-healthcare SETUP/ {print $0; ok=1; next}
        / END e-healthcare OAS SETUP/ {ok=0}
        ok==1 {printf(" #")}
        {print $0}' somefile > newfile

       # only if this works for you
        mv newfile somefile

to find files (under /etc ? really weird)
Code:
grep -l ' END e-healthcare OAS SETUP' /etc/*

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

comment lines

Is there a command to put a comment (#) in a whole part of a shell script? (5 Replies)
Discussion started by: vero_81
5 Replies

2. Shell Programming and Scripting

Removing Duplicate Lines per Section

Hello, I am in need of removing duplicate lines from within a file per section. File: ABC1 012345 header ABC2 7890-000 ABC3 012345 Header Table ABC4 ABC5 593.0000 587.4800 ABC5 593.5000 587.6580 <= dup need to remove ABC5 593.5000 ... (5 Replies)
Discussion started by: petersf
5 Replies

3. Shell Programming and Scripting

Placing Duplicate Lines per section into another file

Hello, I need help in putting duplicate lines within a section into another file. Here is what I'm struggling with: Using this file “data.txt”: ABC1 012345 header ABC2 7890-000 ABC3 012345 Header Table ABC4 ABC5 593.0000 587.4800 ABC5 593.5000 587.6580 <= dup need to remove ABC5... (4 Replies)
Discussion started by: petersf
4 Replies

4. Shell Programming and Scripting

how to add more number in comment section D0000,S0000,D0000,D12345,S12345 |

#!/bin/bash repository=$1; txn=$2; #echo -e "\n\npre-hook Script called\n\n"; logmsg=$(svnlook log ${repository} -t ${txn}); logmsg_vals="${logmsg%%|*}|"; logmsg_char="${logmsg_vals:0:1}"; logmsg_len=$(echo ${logmsg} | cut -d' ' -f1); # logmsg_len2=$(echo ${logmsg} | awk '{print... (1 Reply)
Discussion started by: anuragpgtgerman
1 Replies

5. Shell Programming and Scripting

Comment lines in FSTAB using perl

Hi All, I need to comment specific Two Lines in fstab & want to do using & also want to ensure that is done corretly. I am trying the below method. But its giving Search pattern not terminated. ################ b36376 67 % cat linux-fstab_testing | perl -i -wnl -e '/^('\Q... (1 Reply)
Discussion started by: ajaincv
1 Replies

6. Shell Programming and Scripting

using awk to get specific section of lines in logs

i have a log file that has the date and time that looks like this: Wed Jun 28 15:46:21 2012 test failed tailed passed passed not error panic what we want to focus on is the first 5 columns because they contain the date and time. the date and time can be anywhere on the line. in this... (6 Replies)
Discussion started by: SkySmart
6 Replies

7. Shell Programming and Scripting

Adding a lines to specific section of the file.

Hello, I have to a add 2 lines to /etc/sudoers file under this section below, can someone please suggest script to add these two lines when execute this remotely on to a multiple servers. before ## Allow root to run any commands anywhere root ALL=(ALL) ALL After ## Allow root... (2 Replies)
Discussion started by: bobby320
2 Replies

8. UNIX for Dummies Questions & Answers

Comment lines in file without vi editor

Legends, Can you please help me in following. I need to comment lines from “/tmp/a.txt” from the line A to line B through the command prompt only. Please use variables not direct values like 2 or 5 It can be done with VI editor but it's not matches with my requirement (: 2,5 s/^/#/g). ... (1 Reply)
Discussion started by: sdosanjh
1 Replies

9. Shell Programming and Scripting

Comment ( -- ) lines from 10 to 25 for every .sql file

Platform : RHEL 5.4 I have several .sql files in a directory. I want to comment lines 10 to 25 for all .sql files. How can I do this ? The symbol for comment in SQL is -- eg: -- select salary from emp where empname = 'URS' ; (3 Replies)
Discussion started by: omega3
3 Replies

10. Shell Programming and Scripting

Count lines in section

I am tiring to cont numbers of line between the "!" in CISCO routers I have no problem to extract the input and change the empty line with ! ! 5 Cable5/0/1 U0 4 5 Cable5/0/1 U1 4 ! 5 Cable5/0/1 U2 4 ... (4 Replies)
Discussion started by: sharong
4 Replies
SYSTEMD-VCONSOLE-SETUP.SERVICE(8)			  systemd-vconsole-setup.service			 SYSTEMD-VCONSOLE-SETUP.SERVICE(8)

NAME
systemd-vconsole-setup.service, systemd-vconsole-setup - Configure the virtual console at boot SYNOPSIS
systemd-vconsole-setup.service /usr/lib/systemd/systemd-vconsole-setup DESCRIPTION
systemd-vconsole-setup.service is an early-boot service that configures the virtual console font and console keymap. Internally it calls loadkeys(1) and setfont(8). See vconsole.conf(5) for information about the configuration files understood by this service. KERNEL COMMAND LINE
A few configuration parameters from vconsole.conf may be overridden on the kernel command line: vconsole.keymap=, vconsole.keymap.toggle= Overrides the key mapping table for the keyboard and the second toggle keymap. vconsole.font=, vconsole.font.map=, vconsole.font.unimap= Configures the console font, the console map, and the unicode font map. See vconsole.conf(5) for information about these settings. SEE ALSO
systemd(1), vconsole.conf(5), loadkeys(1), setfont(8), systemd-localed.service(8) systemd 208 SYSTEMD-VCONSOLE-SETUP.SERVICE(8)
All times are GMT -4. The time now is 01:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy