Sponsored Content
Top Forums Shell Programming and Scripting Modify sources.list from script Post 302397190 by Leppie on Sunday 21st of February 2010 09:00:44 AM
Old 02-21-2010
Hi Franklin52,
thanks for your reply.
what i'm trying to do is commenting or uncommenting specific lines. for instance these repositories:
Code:
# deb http://www.lamaresh.net/apt lenny main
# deb-src http://www.lamaresh.net/apt lenny main

could be defined by setting the variable REPO to "lamaresh". however, doing so with the current sed command, it will take both lines while i want to be able to control which line get uncommented.
so i'm looking for something that can search for a string and commit a change in the line containing the search string, but skip the line if another search string is present. i hope this is clear?
so for instance, uncomment/comment if "lamaresh" and "deb" are found, but do nothing if "lamaresh" and "src" are found, with a result like this:
Code:
deb http://www.lamaresh.net/apt lenny main
# deb-src http://www.lamaresh.net/apt lenny main

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Is it possible in a shell script to modify itself ??

We are running a quiz and the data collected from the quiz is submitted to the database. My requirement is to write a shell script to get these submitted records. I should be able to run this shell script at any time and the records it returns should be the ones submitted after the script was... (5 Replies)
Discussion started by: sehgalniraj
5 Replies

2. Shell Programming and Scripting

Modify Perl script to work with txt - Permissions script

Hi I have this code, and i want work with a ls -shalR output in .txt What i need read to do this?? Where start? #!/usr/bin/perl # Allrights- A perl tool for making backups of file permissions # Copyright (C) 2005 Norbert Klein <norbert@acodedb.com> # This program is free... (1 Reply)
Discussion started by: joangopan
1 Replies

3. Shell Programming and Scripting

Request to modify script to list multiple parameters for V_fieldid variable

I am posting a script below which essentially excutes the following functions in the described order. 1) From a source directory pools together three files generated by system logs for each user session, tar's these files and archives them as a log set in a destination directory and these... (0 Replies)
Discussion started by: Sammy
0 Replies

4. Shell Programming and Scripting

Please help to modify my script

Hi, I have a script which connect to ATM's and pull two files from the ATM. The which i try to pull is like PIC20085200001*.JPG First 7 digit consist of year montn and date as well After todays execution i want to change the date to next date I add few lines in the script but it is not... (6 Replies)
Discussion started by: Renjesh
6 Replies

5. Shell Programming and Scripting

script to modify /etc/shadow

Hi I am looking for script to modify /etc/shadow. For example: 1-)User enters username 2-)The line of that user is found in /etc/shadow and *LK* is added infront of the second field in /etc/shadow. How can I do this? Thanks (7 Replies)
Discussion started by: tjay83
7 Replies

6. Shell Programming and Scripting

List files and display last modify time in a particular format

hi everyone, can someone suggest how i can list the contents of a directory and display their corresponding last modify time in the format yyyymmddhhmm? thanks in advance! (16 Replies)
Discussion started by: Deanne
16 Replies

7. Shell Programming and Scripting

how can I modify this script.

hello forum members, I have a script which is used find the Uname and passwords and redirects into a output.txt file.I hardcoded a string "ciadev" but iwant search two more strings also "absdev" and "absprod" So modify this script please. I am lookinmg forward from you, please find the below... (2 Replies)
Discussion started by: rajkumar_g
2 Replies

8. Shell Programming and Scripting

Script to List, Modify, replace filename for an upload?

Hello, here is my problem: I have ma program in a first directory dir1: ls path1/rep1/ file1.f90 file1.f90~ file1.o file2.f90 .... etc... I have modified folder in an other directory: ls path2/rep2/ file1_modified.f90 file2_modified.f90 .... etc... All files from first... (8 Replies)
Discussion started by: shadok
8 Replies

9. Debian

Repositories in sources.list

I'm just interested to know how your sources.list look like. I got some repositories witch give some errors and I would like to clean it up. and when I do apt-get update I get few lines showing errors like 404 , this is how my list look like: # deb cdrom:/ squeeze main # deb cdrom:/... (0 Replies)
Discussion started by: zdorian
0 Replies
BUILD-RDEPS(1)															    BUILD-RDEPS(1)

NAME
build-rdeps - find packages that depend on a specific package to build (reverse build depends) SYNOPSIS
build-rdeps package DESCRIPTION
build-rdeps searches for all packages that build-depend on the specified package. OPTIONS
-u, --update Run apt-get update before searching for build-depends. -s, --sudo Use sudo when running apt-get update. Has no effect if -u is omitted. --distribution Select another distribution, which is searched for build-depends. --only-main Ignore contrib and non-free --exclude-component Ignore the given component (e.g. main, contrib, non-free). --origin Restrict the search to only the specified origin (such as "Debian"). -m, --print-maintainer Print the value of the maintainer field for each package. -d, --debug Run the debug mode --help Show the usage information. --version Show the version information. REQUIREMENTS
The tool requires apt Sources files to be around for the checked components. In the default case this means that in /var/lib/apt/lists files need to be around for main, contrib and non-free. In practice this means one needs to add one deb-src line for each component, e.g. deb-src http://<mirror>/debian <dist> main contrib non-free and run apt-get update afterwards or use the update option of this tool. LICENSE
This code is copyright by Patrick Schoenfeld <schoenfeld@debian.org>, all rights reserved. This program comes with ABSOLUTELEY NO WARRANTY. You are free to redistribute this code under the terms of the GNU General Public License, version 2 or later. AUTHOR
Patrick Schoenfeld <schoenfeld@debian.org> Debian Utilities 2013-12-23 BUILD-RDEPS(1)
All times are GMT -4. The time now is 04:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy