Sponsored Content
Full Discussion: Add comment if not present
Top Forums Shell Programming and Scripting Add comment if not present Post 302928335 by anil510 on Thursday 11th of December 2014 05:09:24 AM
Old 12-11-2014
Add comment if not present

I have a file

Code:
cat /root/file
#import node1
#import node2
import node2
import node4

After sed/awk operation the file should be as follows

Code:
cat /root/file
#import node1
#import node2
#import node2
#import node4

I was able to retrieve the #import, but not able to place comment in missing lines.
Code:
[root@server node]# cat /root/file  |  egrep  -o "[^ ]+import"
#import
#import

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

# comment

Hi guys and Gals AIX 5.1 If I had a # above several scripts would it comment out everything below it? Like this # 01 2 ** ..................................... 02 31 ......................................... # this is a script 03 12 **.......................... Would... (6 Replies)
Discussion started by: rocker40
6 Replies

2. Shell Programming and Scripting

Need to add a comment line in a text file

Hi I need to add a comment line at the begining of a text file. The scenario is given below. 1. The number of servers that needs to be updated is around 80 2. The location of the text file in all the servers are the same including the file name. 3. The comment has to be added at the very... (2 Replies)
Discussion started by: orakhan
2 Replies

3. Shell Programming and Scripting

How to copy and comment out

I need help with a script. Here's what I want to do. I have a file "upsrk.txt" which can be either under "/home/upsrk" OR "/home/oracle" On some systems file "upsrk.txt" may not exist, in that case I want to just exit out of the script. If the file is there, I want to check if I have the... (3 Replies)
Discussion started by: upsrk
3 Replies

4. 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

5. 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

6. Shell Programming and Scripting

add line and remove comment in some script

Hi, i need some help. i am not sure about my idea. I have a script directory under my home directory,which has a lot of scripts in it. These are some names of the scripts in /axxhome/prdv/script aly300.sh axt300.sh arv300.sh clp300.sh ctth300.sh aly400.sh axt400.sh arv400.sh... (6 Replies)
Discussion started by: debu000
6 Replies

7. UNIX for Dummies Questions & Answers

Concatenate files and delete source files. Also have to add a comment.

- Concatenate files and delete source files. Also have to add a comment. - I need to concatenate 3 files which have the same characters in the beginning and have to remove those files and add a comment and the end. Example: cat REJ_FILE_ABC.txt REJ_FILE_XYZ.txt REJ_FILE_PQR.txt >... (0 Replies)
Discussion started by: eskay
0 Replies

8. Shell Programming and Scripting

Help about comment verification

Hello, I have a file, in which line 40 is commented. It is basically a cron job, #05,35,50 * * * * /usr/local/scripts/my.sh how i can i verify the line 40 is commented, if not then give me message not commented, otherwise provide us message it is commented. (5 Replies)
Discussion started by: learnbash
5 Replies

9. Shell Programming and Scripting

Search, and add if present

Dear All, I have to find a way to reorganize a table file according to the last column. The input file looks like this: cat Input1.txt: ID:12:23:00Q EU232 2342 234 123 231 aa1;ab2 ID:11:22:00E EU112 1232 211 112 233 ab2;ac3 ID:19:24:00S EU121 569 ... (7 Replies)
Discussion started by: loba
7 Replies

10. Shell Programming and Scripting

Add comment on last line if found match

Hi All, totally new on it , normally use it for just 1 line. i'm looking for help. i'm have 2 file. file 1 : -------------------------------------------------- c12 c1 c3 -------------------------------------------------- file 2: other content ... (10 Replies)
Discussion started by: kttan
10 Replies
GIT-IMPORT-DSCS(1)					      git-buildpackage Manual						GIT-IMPORT-DSCS(1)

NAME
git-import-dscs - Import multiple versions of a Debian source packages into a Git repository SYNOPSIS
git-import-dscs [ options ] [ git-import-dsc options ] pkg_1.dsc pkg_2.dsc ... or git-import-dscs --debsnap [ options ] [ git-import-dsc options ] package DESCRIPTION
git-import-dscs imports several versions of a Debian source package into a Git repository. To do so it sorts the packages by their versions first and then imports them via calling git-import-dsc on each package. If the current directory isn't a Git repository already the repository is created in a subdir of the current working directory, named after the first imported package, otherwise the Git repository in the current working directory is being used. This allows for incremental imports. OPTIONS
--debsnap Fetch snapshots from snapshots.debian.org using debsnap. --ignore-repo-config Ignore gbp.conf files stored in the git repository itself. This can be useful to ignore branch informations and other options shipped in the package source. All other options are passed on verbatim to git-import-dsc. SEE ALSO
git-import-dsc(1), git-buildpackage(1), git-import-orig(1), git-dch(1), gbp.conf(5), debuild(1), git(1), pristine-tar(1), The Git-Build- package Manual <URL:file:///usr/share/doc/git-buildpackage/manual-html/index.html> AUTHOR
Guido Guenther <agx@sigxcpu.org> 01 June 2012 GIT-IMPORT-DSCS(1)
All times are GMT -4. The time now is 05:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy