I am writing some fairly heavy software. As of current solely in bash. It will change the world when I am done. Why do I ask for help? I am thinking a ( as a variable has me stumped. The ones commented I have played with 0 results, $PWD is the current folder we are playing with as per bash.
The software is recursive in it's job, do not assume the same variable. I do NOT WANT to punch it to a new file, -i -e sed does not return the results I am looking for.
Prerequisites: $FILE=azenis-theme-pack_0.0.4_all.deb
$CONTROL=$PWD/azenis-theme-pack_0.0.4_all/DEBIAN/control
$DEPENDS="libc6 (>= 2.5-0ubuntu1), initramfs-tools (>= 0.40ubuntu30), gtk2-engines-aurora"
Code:
function Addcontrol(){
CONTROL=$PWD/DEBIAN/control
DEPENDS=$(cat $CONTROL | grep "Depends:" | cut -d: -f2)
if [[ $DEPENDS != "" ]]; then
STRIPNAME=$DEPENDS", python"
echo "Original Depends section: "$DEPENDS
echo "New dependancy list: "$STRIPNAME
echo "Adding dependancy: python to $CONTROL"
sed -i -e "s/'$DEPENDS'/'$STRIPNAME'/g'" $CONTROL > $CONTROL".NEW"
else
echo "No Depends: section in control file creating section and adding python to the list."
###BLAH BLAH HERE
fi
#sed "s/$DEPENDS/$/g' control > new.file
#sed 's/, '$STRIPNAME'//g' $CONTROL
#sed -i 's'$DEPENDS'/'$STRIPNAME'/' $CONTROL
#sed -i -e "s/'$DEPENDS'/'$STRIPNAME'/g" $CONTROL
#echo $CONTROL | sed "s/'$DEPENDS'/'$STRIPNAME'/g" $CONTROL
else
echo "No Depends: section in control file creating section and adding python to the list."
# Read control file searching for pattern deleting requires $STRIPNAME
# pipe it 3 times first in case it is not the only "requires"
# second in case no space was used after the comma
# third a catch all. IE the only requires.
#sed 's/, '$STRIPNAME'//g' $CONTROL
#sed 's/,'$STRIPNAME'//g' $CONTROL
#sed 's/'$STRIPNAME'//g' $CONTROL
fi
}
Use -i f you want to do in-place editing (only with GNU sed), redirect to a new file without -i if you don't..
---------- Post updated at 15:29 ---------- Previous update was at 14:42 ----------
If one of the variables may contain slashes you would need to change the separator to a character that will never be present, for example if they never contain pipe characters:
Code:
sed -i "s|$DEPENDS|$STRIPNAME|g" "$CONTROL"
Last edited by Scrutinizer; 01-20-2011 at 09:54 AM..
Use -i f you want to do in-place editing (only with GNU sed), redirect to a new file without -i if you don't..
---------- Post updated at 15:29 ---------- Previous update was at 14:42 ----------
If one of the variables may contain slashes you would need to change the separator to a character that will never be present, for example if they never contain pipe characters:
Code:
sed -i "s|$DEPENDS|$STRIPNAME|g" "$CONTROL"
I thought I was "TheeMahn", Thanks. I was on the " v/s ', but the results are perfect. Scrutinizer, I do not thank you the end user will. I take that back. Thanks.
---------- Post updated at 09:57 AM ---------- Previous update was at 09:51 AM ----------
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -c azenis-theme-pack_0.0.4_all
azenis-theme-pack_0.0.4_all
WARNING: this will recursively delete all of the above directories. Proceed? y
Scraping...
Deleting: azenis-theme-pack_0.0.4_all
Removing all error logs.
rm azenis-theme-pack_0.0.4_all.deb.errors ubiquity-slideshow-ubuntu_30_all.deb.errors ubuntu-tweak_0.5.7-1_all.deb.errors ultimate-edition-customizations-2.9.0_all.deb.errors ultimate-edition-nautilus-scripts-1.7_all.deb.errors ultimate-edition-theme-2.1.5_all.deb.errors
Process complete.
theemahn@SledgeHammer:/media/Tuneage/29$
This is what you get if you use in-place editing (-i) option and you run the same statement twice...
Code:
WARNING: this will recursively delete all of the above directories. Proceed? y
Scraping...
Deleting: azenis-theme-pack_0.0.4_all
rm: cannot remove `azenis-theme-pack_0.0.4_all': No such file or directory
Removing all error logs.
rm azenis-theme-pack_0.0.4_all.deb.errors ubiquity-slideshow-ubuntu_30_all.deb.errors ubuntu-tweak_0.5.7-1_all.deb.errors ultimate-edition-customizations-2.9.0_all.deb.errors ultimate-edition-nautilus-scripts-1.7_all.deb.errors ultimate-edition-theme-2.1.5_all.deb.errors
Process complete.
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -f azenis-theme-pack_0.0.4_all
azenis-theme-pack_0.0.4_all folder not found. repomaster -help for help or man repomaster for further information.
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -b azenis-theme-pack_0.0.4_all
Nothing to build. repomaster -help for assistance.
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -e azenis-theme-pack_0.0.4_all
azenis-theme-pack_0.0.4_all not found. repomaster -help for help or man repomaster for further information.
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -e azenis-theme-pack_0.0.4_all.deb
=================================
Beginning extraction of azenis-theme-pack_0.0.4_all.deb
=================================
to azenis-theme-pack_0.0.4_all/
Extracting Control files from azenis-theme-pack_0.0.4_all.deb
Extracting data files from azenis-theme-pack_0.0.4_all.deb
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -b azenis-theme-pack_0.0.4_all
Cleaning up prior to build. We will have no errors.
=================================
Beginning build of azenis-theme-pack_0.0.4_all/
=================================
Relaxing permissions of azenis-theme-pack_0.0.4_all/
Cleaning up any tmp or backup files.
Setting individual file permissions to 644.
Scanning for executables in azenis-theme-pack_0.0.4_all/
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/players/ListenPlayer.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/players/ExailePlayer03.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/players/player.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/lyricsengine/lrcdb.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/lyricsengine/ALSong.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/lyricsengine/minilyrics.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/lyricsengine/engine.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/Quodlibet plugin/LyricsScreenletInformator.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/LyricsPanel.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/LyricsScreenlet.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/widget.py
Non conforming executables found:
Setting Executable bit for: ./usr/share/screenlets/Lyrics/players/ListenPlayer.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/players/ExailePlayer03.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/players/player.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/lyricsengine/lrcdb.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/lyricsengine/ALSong.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/lyricsengine/minilyrics.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/lyricsengine/engine.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/Quodlibet plugin/LyricsScreenletInformator.py
chmod: cannot access `./usr/share/screenlets/Lyrics/Quodlibet': No such file or directory
chmod: cannot access `plugin/LyricsScreenletInformator.py': No such file or directory
Setting Executable bit for: ./usr/share/screenlets/Lyrics/LyricsPanel.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/LyricsScreenlet.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/widget.py
Calculating MD5SUMS in azenis-theme-pack_0.0.4_all/
Setting ownership to root in azenis-theme-pack_0.0.4_all/
Setting individual folder permissions to 755.
Changing folder to azenis-theme-pack_0.0.4_all/DEBIAN/
Setting permissions rights for control etc.
Beginning build of azenis-theme-pack_0.0.4_all/
dpkg-deb: building package `azenis-theme-pack' in `azenis-theme-pack_0.0.4_all.deb'.
Lintian resulting package azenis-theme-pack_0.0.4_all.deb.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/LyricsPanel.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/LyricsScreenlet.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/Quodlibet plugin/LyricsScreenletInformator.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/lyricsengine/ALSong.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/lyricsengine/engine.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/lyricsengine/lrcdb.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/lyricsengine/minilyrics.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/players/ExailePlayer03.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/players/ListenPlayer.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/players/player.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/widget.py Logged to all_errors.txt.
azenis-theme-pack_0.0.4_all/ Errors recorded: 0, Warnings recorded: 0
Error: A major issue has occured building one of the deb files. Please see build.log and *.errors
theemahn@SledgeHammer:/media/Tuneage/29$
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -c azenis-theme-pack_0.0.4_all
azenis-theme-pack_0.0.4_all
WARNING: this will recursively delete all of the above directories. Proceed? y
Scraping...
Deleting: azenis-theme-pack_0.0.4_all
Removing all error logs.
rm azenis-theme-pack_0.0.4_all.deb.errors ubiquity-slideshow-ubuntu_30_all.deb.errors ubuntu-tweak_0.5.7-1_all.deb.errors ultimate-edition-customizations-2.9.0_all.deb.errors ultimate-edition-nautilus-scripts-1.7_all.deb.errors ultimate-edition-theme-2.1.5_all.deb.errors
Process complete.
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -e azenis-theme-pack_0.0.4_all.deb
rm: cannot remove `*s.txt': No such file or directory
=================================
Beginning extraction of azenis-theme-pack_0.0.4_all.deb
=================================
to azenis-theme-pack_0.0.4_all/
Extracting Control files from azenis-theme-pack_0.0.4_all.deb
Extracting data files from azenis-theme-pack_0.0.4_all.deb
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -b azenis-theme-pack_0.0.4_all.deb
Cleaning up prior to build. We will have no errors.
Nothing to build. repomaster -help for assistance.
I will make your code be the awe.
Results of your code is coming.
I seen it go through, I will not quit until it is viewed that way...
---------- Post updated at 10:41 AM ---------- Previous update was at 10:09 AM ----------
Quote:
Originally Posted by Scrutinizer
This is what you get if you use in-place editing (-i) option and you run the same statement twice...
Code:
WARNING: this will recursively delete all of the above directories. Proceed? y
Scraping...
Deleting: azenis-theme-pack_0.0.4_all
rm: cannot remove `azenis-theme-pack_0.0.4_all': No such file or directory
Removing all error logs.
rm azenis-theme-pack_0.0.4_all.deb.errors ubiquity-slideshow-ubuntu_30_all.deb.errors ubuntu-tweak_0.5.7-1_all.deb.errors ultimate-edition-customizations-2.9.0_all.deb.errors ultimate-edition-nautilus-scripts-1.7_all.deb.errors ultimate-edition-theme-2.1.5_all.deb.errors
Process complete.
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -f azenis-theme-pack_0.0.4_all
azenis-theme-pack_0.0.4_all folder not found. repomaster -help for help or man repomaster for further information.
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -b azenis-theme-pack_0.0.4_all
Nothing to build. repomaster -help for assistance.
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -e azenis-theme-pack_0.0.4_all
azenis-theme-pack_0.0.4_all not found. repomaster -help for help or man repomaster for further information.
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -e azenis-theme-pack_0.0.4_all.deb
=================================
Beginning extraction of azenis-theme-pack_0.0.4_all.deb
=================================
to azenis-theme-pack_0.0.4_all/
Extracting Control files from azenis-theme-pack_0.0.4_all.deb
Extracting data files from azenis-theme-pack_0.0.4_all.deb
theemahn@SledgeHammer:/media/Tuneage/29$ repomaster -b azenis-theme-pack_0.0.4_all
Cleaning up prior to build. We will have no errors.
=================================
Beginning build of azenis-theme-pack_0.0.4_all/
=================================
Relaxing permissions of azenis-theme-pack_0.0.4_all/
Cleaning up any tmp or backup files.
Setting individual file permissions to 644.
Scanning for executables in azenis-theme-pack_0.0.4_all/
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/players/ListenPlayer.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/players/ExailePlayer03.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/players/player.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/lyricsengine/lrcdb.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/lyricsengine/ALSong.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/lyricsengine/minilyrics.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/lyricsengine/engine.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/Quodlibet plugin/LyricsScreenletInformator.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/LyricsPanel.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/LyricsScreenlet.py
azenis-theme-pack_0.0.4_all/usr/share/screenlets/Lyrics/widget.py
Non conforming executables found:
Setting Executable bit for: ./usr/share/screenlets/Lyrics/players/ListenPlayer.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/players/ExailePlayer03.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/players/player.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/lyricsengine/lrcdb.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/lyricsengine/ALSong.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/lyricsengine/minilyrics.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/lyricsengine/engine.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/Quodlibet plugin/LyricsScreenletInformator.py
chmod: cannot access `./usr/share/screenlets/Lyrics/Quodlibet': No such file or directory
chmod: cannot access `plugin/LyricsScreenletInformator.py': No such file or directory
Setting Executable bit for: ./usr/share/screenlets/Lyrics/LyricsPanel.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/LyricsScreenlet.py
Setting Executable bit for: ./usr/share/screenlets/Lyrics/widget.py
Calculating MD5SUMS in azenis-theme-pack_0.0.4_all/
Setting ownership to root in azenis-theme-pack_0.0.4_all/
Setting individual folder permissions to 755.
Changing folder to azenis-theme-pack_0.0.4_all/DEBIAN/
Setting permissions rights for control etc.
Beginning build of azenis-theme-pack_0.0.4_all/
dpkg-deb: building package `azenis-theme-pack' in `azenis-theme-pack_0.0.4_all.deb'.
Lintian resulting package azenis-theme-pack_0.0.4_all.deb.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/LyricsPanel.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/LyricsScreenlet.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/Quodlibet plugin/LyricsScreenletInformator.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/lyricsengine/ALSong.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/lyricsengine/engine.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/lyricsengine/lrcdb.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/lyricsengine/minilyrics.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/players/ExailePlayer03.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/players/ListenPlayer.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/players/player.py Logged to all_errors.txt.
Error: E: azenis-theme-pack: python-script-but-no-python-dep ./usr/share/screenlets/Lyrics/widget.py Logged to all_errors.txt.
azenis-theme-pack_0.0.4_all/ Errors recorded: 0, Warnings recorded: 0
Error: A major issue has occured building one of the deb files. Please see build.log and *.errors
theemahn@SledgeHammer:/media/Tuneage/29$
Results of your code is coming.
First of all: I want you to know who I am :<url removed by mod>. I also want to thank you for bringing me though my hard time. I assure you my issue is gone. Only 1000+ more to go through , PPL are wanting to copywrite what I am doing. Please feel me.
Last time I checked, I am a programmer, this may hit a level six programmer. What is a level 6? Automation. That is what I am going to provide. Ignore: <url removed by mod>. Search <search term removed by mod> in google, you will know who I am.
Last edited by Scott; 01-20-2011 at 03:01 PM..
Reason: Thread closed by mod
Hi Gurus,
i have files like this and i want to rename it.
server1_0_Log0000597500
server1_0_Log0000597501
server1_0_Log0000597502
server1_0_Log0000597503
server1_0_Log0000597504
server1_0_Log0000597505
server1_0_Log0000597506
server1_0_Log0000597507
server1_0_Log0000597508... (7 Replies)
Hey guys,
I have this file generated by me... i want to create some HTML output from it.
The problem is that i am really confused about how do I go about reading the file.
The file is in the following format:
TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Here is a data file, which I believe is in YAML. I am trying to retrieve just the 'addon_domains" section, which doesnt seem to be as easy as I had originally thought. Any help on this would be greatly appreciated!! I have been trying to do this in awk and mostly bash scripting instead of perl... (3 Replies)
Hi Experts,
Im a new bee for scripting,
I would ned to do the following via linux shell scripting, I have an application which throws a log file, on each action of a particular work with the application, as sson as the action is done, the log file would vanish or stops updating there, the... (2 Replies)
Hello,
I have a file which contains groups of fields. These groups are separated by a blank line, to form a logical record.
Each line consists of a field-value pair.
If want to find all records where field 'd' has a value of '4' and if it does, I want the value of field 'a' (from the... (4 Replies)
Hi Scripting Gurus,
I am trying to parse a csv file and generate a new output file.
The input file will be a variable length in turns of rows and columns.
output file will have 8 columns. we have three columns from the header for each set.
just to give little bit more clarification each row... (15 Replies)
I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves.
Also, the script should only move a file from /exports to... (6 Replies)
Hi,
I need a shell script that would parse this file
/usr/share/i18n/locales/aa_DJ:title "Afar language locale for Djibouti (Cadu/Laaqo Dialects)."
/usr/share/i18n/locales/aa_ER:title "Afar language locale for Eritrea (Cadu/Laaqo Dialects)."
/usr/share/i18n/locales/aa_ER@saaho:title... (2 Replies)