[SOLVED] sed help please...
I'm trying to modify an XFWM theme, and need to run sed to replace colors with a phrase to make it "blend in" with the GTK theme. Unfortunately, it isn't working. Can anyone help?
Here is what I am trying to run:
sed -e 's/\#E6E6E6/\#E6E6E6 s active_color_2/g' *-active.xpm
The result of that gives me something similar to running cat *-active.xpm.
Last edited by smartboyathome (2009-03-25 21:49:53)
the above should work but i'd script it:
edit that, the above will work and will work better, faster and more efficiently...
but i'd still script it
#!/bin/bash
find ./ -name '*-active.xpm' | while read file; do
cp $file $file.orig
cat $file | sed 's/\#E6E6E6/\#E6E6E6 s active_color_2/g' > temp
mv temp $file
done
Last edited by brisbin33 (2009-03-25 21:39:20)
Similar Messages
-
[SOLVED] printer help please SOS HELP !!!!
Recently, I wanted to print something, so I followed the instructions on installing a printer on arch wiki about cups. I followed every piece of instruction, but none did the trick. I even tried installing my printer from hp-toolbox, but it gave me and error saying printer queque failed. I have an HP photosmart c4400. It works for every other OS. Please help.
Last edited by raj7095 (2010-02-16 22:36:37)Is this really so big of an "SOS HELP!!!!" that you need to bump it after 7 minutes? Good policy is to bump after 2 days, if you really can't find anything. Try to provide more information in posts or do more digging and state what you've tried since the last post. http://wiki.archlinux.org/index.php/For … te#Bumping
Where does it say "printer queque failed"? Did you really try everything on the wiki page about CUPS? My printer works fine but I don't have the same one as you. Does the wiki page say anything about blacklisting/rmmod-ing modules? I've seen that mentioned in other threads, but I don't know which module. Please wait for somebody that knows, I'm sure somebody can help. -
Grep / sed help please..
am trying to make a new pkgbuild but the install dirs are coded in the makefile and will not be overridden with DESTDIR or prefix
in the makefile i have already sed out the references to local, however the variables for bin-prefix, data_prefix and highscore_prefix are on lines 1,2 and three respectively.
the sed command for removing local was lifted from another pkgbuild
as i see it there are a few options one is to remove lines 1,2,3 and then move the directories to pkg to be tarred up or to insert pkg into 1,2,3
i know you can also bind the root of the package but am stumped as to the correct commands, any ideas guys?Sorry :oops:
here is the pkg build
pkgname=twind
pkgver=1.1.0
pkgrel=1
pkgdesc="An addictive block game"
url="http://twind.sourceforge.net"
depends=('sdl' 'sdl_image' 'sdl_mixer')
source=(http://dl.sourceforge.net/sourceforge/twind/twind-1.1.0.tar.gz)
md5sums=('672dfe032e1f5657996b64cd666aef50')
build() {
cd $startdir/src/$pkgname-$pkgver
sed -i -e "s:local/::" Makefile
make || return 1
mkdir -p $startdir/pkg/usr
make prefix=$startdir/pkg install
but the install command in the makefile will not accept external variable
here is the makefile...
# ONLY CHANGE THESE THREE OPTIONS IF YOU KNOW WHAT YOU ARE DOING
BIN_PREFIX = /usr/bin/
# if you don't have privileges to install systemwide, comment out both
# lines below and the game will then play from the current directory
DATA_PREFIX = /usr/share/games/twind/
HIGH_SCORE_PREFIX = /var/lib/games/twind/
# uncomment out the EXTENSION if you don't have the png libs on your system
#EXTENSION = ".bmp"
AUDIOFLAG = AUDIO
CC = gcc
ifdef EXTENSION
CFLAGS = -Wall -g -DDATA_PREFIX="$(DATA_PREFIX)"
-DEXTENSION="$(EXTENSION)" -D$(AUDIOFLAG) -DLINUX
-DHIGH_SCORE_PREFIX="$(HIGH_SCORE_PREFIX)"
else
CFLAGS = -Wall -g -DDATA_PREFIX="$(DATA_PREFIX)" -D$(AUDIOFLAG) -DLINUX
-DHIGH_SCORE_PREFIX="$(HIGH_SCORE_PREFIX)"
endif
LIBS = -lm
SDL_CFLAGS = `sdl-config --cflags`
SDL_LIBS = `sdl-config --libs` -lSDL_image
MIXER_LIB = -lSDL_mixer
all: twind
install:
mkdir -p $(DATA_PREFIX)graphics
mkdir -p $(DATA_PREFIX)music
mkdir -p $(DATA_PREFIX)sound
mkdir -p $(HIGH_SCORE_PREFIX)
ifdef EXTENSION
cp -r graphics/*.bmp $(DATA_PREFIX)graphics
else
cp -r graphics/*.png $(DATA_PREFIX)graphics
endif
cp -r music/*.ogg $(DATA_PREFIX)music
cp -r sound/*.wav $(DATA_PREFIX)sound
cp twind $(BIN_PREFIX)
chown root:games $(BIN_PREFIX)twind
chmod g+s $(BIN_PREFIX)twind
touch $(HIGH_SCORE_PREFIX)twind.hscr
chown root:games $(HIGH_SCORE_PREFIX)twind.hscr
chmod 664 $(HIGH_SCORE_PREFIX)twind.hscr
uninstall:
rm -rf $(DATA_PREFIX)
rm -f $(BIN_PREFIX)twind
noaudio:
make twind MIXER_LIB= AUDIOFLAG=NOAUDIO
twind: twind.o
$(CC) twind.o $(LIBS) $(SDL_LIBS) $(MIXER_LIB) -o twind
twind.o: twind.c
$(CC) $(CFLAGS) $(SDL_CFLAGS) -c twind.c
clean:
rm -f twind *.o
as i said from what i can tell i can either remove the variable and get it to build selfcontained and move this to pkg to be compressed
insert /pkg into the makefile
or bind the root of the install into $startdir
is this any clearer
as i understand it any of these options will put the needed files into pkg for makepkg to compress. -
[solved]bash help please: sort files & recognize duplicates
Hi!
I'm trying to move/rename all files in a folder and its subfolder by age. And move duplicate files somewhere else. The output looks mostly fine, the tmp files too... but I can't figure out, why the duplicate files handling isn't working. edit: the line that sets the new name (&& newname="$1/.dupes/$dname/$part1_$part2_$fname" \) just doesn't seem to get executed here...
#!/bin/bash
pushd "$1" && {
rafi="/tmp/$RANDOM.size.md5.list" && echo > "$rafi"
find $1 -type f -print0 | while read -d $'\0' file;
do \
fname=$(basename "$file")
dname=$(dirname "$file")
part1=$(stat -c%y "$file" | awk -F " |:|\\\.|-" '{printf $1"-"$2"-"$3}')
part2=$(stat -c%y "$file" | awk -F " |:|\\\.|-" '{printf $4"-"$5"-"$6}')
echo "$bname" | grep -q "$part1" && part1=""
echo "$bname" | grep -q "$part2" && part2=""
newname="$1/$part1/$part2_$fname"
size="size$(stat -c%s "$file")"
grep -q "$size" "$rafi" \
md5="md5$(md5sum -b "$file" | sed "s/ .*//")"
grep -q "$md5" "$rafi" \
&& newname="$1/.dupes/$dname/$part1_$part2_$fname" \
|| {
echo "$md5" >> "$rafi"
} || {
echo "$size" >> "$rafi"
newname=$(echo "$newname" | sed "s/\/\/*/\//g" | sed "s/\.~.~//g")
if [ "$newname" != "$file" ];
then if ! [ -d $(dirname "$newname") ]
then echo mkdir -p $(dirname "$newname") -v
fi
echo mv "$file" "$newname" -v --backup=numbered
fi
done
popd
What am I doing wrong? Been trying for hours - I just don't get it...
Thanks!
Last edited by whoops (2011-03-01 10:19:48)thx, that brought me a little closer!
juster wrote:I don't usually say this for bash but your style is hard to read.
Oops... thought so - never had an easy time writing readable code. Or readable anything... Maybe this is not as bad:
#!/bin/bash
if pushd "$1"
then
# random tmp file for filesize + md5
rafi="/tmp/$RANDOM.size.md5.list" && echo > "$rafi"
# for all files in folder $1 + subfolders...
find $1 -type f -print0 | while read -d $'\0' file
do
fname=$(basename "$file")
dname=$(dirname "$file")
# Get year-month-day
part1=$(stat -c%y "$file" | awk -F " |:|\\\.|-" '{printf $1"-"$2"-"$3}')
# Get hour-minute-second
part2=$(stat -c%y "$file" | awk -F " |:|\\\.|-" '{printf $4"-"$5"-"$6}')
# Don't add this info to new filename if it is already in old filename
echo "$bname" | grep -q "$part1" && part1=""
echo "$bname" | grep -q "$part2" && part2=""
# Destination filename
newname="$1/$part1/${part2}_$fname"
size="size$(stat -c%s "$file")"
# have files with the same size already been processed?
if grep -q $size "$rafi"
then
md5="md5$(md5sum -b "$file" | sed "s/ .*//")"
# have files with the same md5 already been processed?
if grep -q $md5 "$rafi"
# set different destination for duplicate files
then newname="$1/.dupes/$dname/${part1}_${part2}_$fname"
# write md5 to tmp file
else echo $md5 >> "$rafi"
fi
# write size to tmp file
else echo "$size" >> "$rafi"
fi
# remove double slashes
newname=$(echo "$newname" | sed "s/\/\/*/\//g" | sed "s/\.~.~//g")
if [ "$newname" != "$file" ]
then if ! [ -d $(dirname "$newname") ]
then echo mkdir -p $(dirname "$newname") -v
fi
echo mv "$file" "$newname" -v --backup=numbered
fi
done
popd
fi
Renaming seems to work correctly now, but it's still only giving me one "dupe mv line" for my test in /etc/X11 and it's not giving me any for the many duplicates in my huge digicam folder.
$ sort_by_date /etc/X11/
~
mkdir -p /etc/X11/2011-02-27 -v
mv /etc/X11/xorg.conf.bak /etc/X11/2011-02-27/19-43-36_xorg.conf.bak -v --backup=numbered
mkdir -p /etc/X11/2010-06-21 -v
mv /etc/X11/xorg.conf.d/20-nvidia.conf /etc/X11/2010-06-21/10-12-35_20-nvidia.conf -v --backup=numbered
mkdir -p /etc/X11/2010-08-24 -v
mv /etc/X11/xorg.conf.d/10-evdev.conf /etc/X11/2010-08-24/15-45-35_10-evdev.conf -v --backup=numbered
mkdir -p /etc/X11/2010-09-01 -v
mv /etc/X11/xorg.conf.d/20-nvidia.conf.pacnew /etc/X11/2010-09-01/12-16-10_20-nvidia.conf.pacnew -v --backup=numbered
mkdir -p /etc/X11/2010-11-30 -v
mv /etc/X11/xorg.conf.d/20-keyboard.conf /etc/X11/2010-11-30/10-27-00_20-keyboard.conf -v --backup=numbered
mkdir -p /etc/X11/2010-05-26 -v
mv /etc/X11/xorg.conf.d/10-quirks.conf /etc/X11/2010-05-26/21-51-03_10-quirks.conf -v --backup=numbered
mkdir -p /etc/X11/2010-01-03 -v
mv /etc/X11/xorg.conf /etc/X11/2010-01-03/10-56-25_xorg.conf -v --backup=numbered
mkdir -p /etc/X11/.dupes/etc/X11 -v
mv /etc/X11/xorg.conf.dub /etc/X11/.dupes/etc/X11/2011-02-27_19-43-52_xorg.conf.dub -v --backup=numbered
mkdir -p /etc/X11/2010-07-10 -v
mv /etc/X11/Xsession /etc/X11/2010-07-10/20-01-30_Xsession -v --backup=numbered
mkdir -p /etc/X11/2010-12-22 -v
mv /etc/X11/xinit/xinitrc.d/30-dbus /etc/X11/2010-12-22/15-39-41_30-dbus -v --backup=numbered
mkdir -p /etc/X11/2010-11-28 -v
mv /etc/X11/xinit/xinitrc.d/40-libcanberra-gtk-module /etc/X11/2010-11-28/02-44-08_40-libcanberra-gtk-module -v --backup=numbered
mkdir -p /etc/X11/2010-12-19 -v
mv /etc/X11/xinit/xserverrc /etc/X11/2010-12-19/11-58-47_xserverrc -v --backup=numbered
mkdir -p /etc/X11/2010-11-15 -v
mv /etc/X11/xinit/xinitrc /etc/X11/2010-11-15/11-39-17_xinitrc -v --backup=numbered
~
Still don't get it where this problem could be coming from...
md5sum * 2>/dev/null | sort -k 1 | uniq -d -w 32 | cut -c 35-
That's beautiful, just I have no idea how to use it in the context of what I'm trying to do.
Last edited by whoops (2011-02-28 13:00:27) -
i want this 'N;s/\n/ /;P;D;' to go into a file but when i try it comes out as this 'N;s/ / /;P;D;'
how can i make the \n copy over, i've tried searching but no luck.
Last edited by moofly (2012-09-03 04:12:25)input
comm -13 '\''/home/ryan/Computer Backup/main/main programs'\'' '\''/home/ryan/Computer Backup/backup/backup programs'\'' | sed '\''1isudo pacman -Runs'\''| sed '\''N;s/\n/ /;P;D;'\'' | sed '\''N;s/\n/ /;P;D;'\'' | sed '\''N;s/\n/ /;P;D;'\'' | sed '\''N;s/\n/ /;P;D;'\'' | sed '\''N;s/\n/ /;P;D;'\'' > '\''/home/ryan/Computer Backup/backup/backup remove'\''
output
comm -13 '/home/ryan/Computer Backup/main/main programs' '/home/ryan/Computer Backup/backup/backup programs' | sed '1isudo pacman -Runs'| sed 'N;s/\n/ /;P;D;' | sed 'N;s/ / /;P;D;' | sed 'N;s/ / /;P;D;' | sed 'N;s/ / /;P;D;' | sed 'N;s/ / /;P;D;' > '/home/ryan/Computer Backup/backup/backup remove'
all the
'N;s/ / /;P;D;'
in the output are supposed to be
'N;s/\n/ /;P;D;'
thats not everything that goes into the file but its the section im having trouble with. Since thats not everything, i don't think echo will work unless i can choose where to put the text. If i can choose where to put the text let me know.
Last edited by moofly (2012-09-03 03:47:48) -
My iPad shows a message "Cannot find AirPrint printer". I used to use my iPad to print materials using HP wireless printer D110. Now it does not want to print. Is this because I am now using IOS 7? What should I do to solve the problem? Help please.
Restart your WiFi router and printer by removing power for 30 seconds.
-
my apple id is not working when i sign in from my laptop it works but when i sign in from my iphone4 then its not working it gives the message of "your aapleid or password is incorrect"? how can i solve this problem please help
Hey nocillado,
Thanks for using Apple Support Communities.
It sounds like you have 2 things you want to address. These articles can help you use iCloud with your existing Apple ID.
Get help activating your iPhone
http://support.apple.com/kb/ts3424
Using your Apple ID for Apple services
http://support.apple.com/kb/ht4895
Using the same Apple ID for Store purchases and iCloud (recommended)
Have a nice day,
Mario -
my iphone is on recovery mode and i can´t turn on it, when i try to recover it from itunes i get: unknown error (36), i´ve tried to do lot of things but i can´t solve my problem. please help!!
Hi, i had the same problem. Try to find the file "apple" or "itunes" don't know it anymore exactly. Ahm well you need to delet any information or just plug in your iphone into an other computer. important is that your iphone never has been pluged in this computer before. This was what i did, and it worked!
-
Few days before I brought one iphone 5 by second party and this phone make a unlock but it sometime have a cellular network most of time say no service can u solve this problem please and I put serial number it say this phone is replace can u help me for original serial number....
If Apple's service database says that your iPhone was replaced, then Apple will no longer provide any service for that phone.
First, get a new SIM from your cell carrier and see if that corrects the problem. If it does not, try the usual steps for addressing software problems: restart, reset, restore.
http://support.apple.com/kb/HT1430
http://support.apple.com/kb/HT1414
If you try restoring from a backup and that doesn't fix the problem, try restoring to factory settings and, if the problem goes away, then sync back your apps and content. You'll lose the app data and settings, but if the problem is due to a corrupt cache or settings file, restoring to factory settings should cure it.
If none of that helps, your device may have developed a hardware fault. Again, Apple will provide no service for it, so you will need to pay some independent repair shop to fix your iPhone.
Regards. -
my iphone 4 is acting like crap right i can't even restore it everytime i try to reboot it my iphone freezes at the apple logo it is ******* me off to the point where i just want to smash it how do i solve this problem please help?
Don't worry, just follow these steps to fix iPhone stuck on Apple logo
=> First of all Start your Computer and then connect with Internet connection, now Download the latest version of the iTunes application
=> Now install the iTunes application in your System and connect your Device with computer via Data cable
=> Now connect your Device with iTunes application and then Tab on summary option, see in the left side bar of iTunes
=> Now Select restore option from iTunes and then confirm the Restore Message for better results. After this unplug your Device and Restart it
I hope that will surely
Thank you... -
My iPad stop working suddenly i see black screen only pressing the home and sleep button dose not solve the problem please help ?
Frozen or unresponsive iPad
Resolve these most common issues:
• Display remains black or blank
• Touch screen not responding
• Application unexpectedly closes or freezes
http://www.apple.com/support/ipad/assistant/ipad/
iPad Frozen, not responding, how to fix
http://appletoolbox.com/2012/07/ipad-frozen-not-responding-how-to-fix/
iPad Frozen? How to Force Quit an App, Reset or Restart Your iPad
http://ipadacademy.com/2010/11/ipad-frozen-how-to-force-quit-an-app-reset-or-res tart-your-ipad
Black or Blank Screen on iPad or iPhone
http://appletoolbox.com/2012/10/black-or-blank-screen-on-ipad-or-iphone/
What to Do When Your iPad Won't Turn On
http://ipad.about.com/od/iPad_Troubleshooting/ss/What-To-Do-When-Your-Ipad-Wo-No t-Turn-On.htm
iOS: Not responding or does not turn on
http://support.apple.com/kb/TS3281
Home button not working or unresponsive, fix
http://appletoolbox.com/2013/04/home-button-not-working-or-unresponsive-fix/
Fixing an iPad Home Button
http://tinyurl.com/om6rd6u
iPad: Basic troubleshooting
http://support.apple.com/kb/TS3274
Cheers, Tom -
Hi .. my iPad 4 with iso 7.0.3 he is restarting himself ... How can i solve this problem please help me
Standard troubleshooting...
1. Try a Restart by pressing the sleep/lock button until you see the slider. Slide to power off. Restart by pressing the sleep/lock button until you see the Apple logo.
2. Try a Reset by pressing the home and sleep buttons until you see the Apple logo. Takes about 5-15 secs of button holding and you won't lose any data or settings.
3. Remove apps from Recently Used list...
- From any Home Screen, double tap the home button to bring up the Recents List
- Swipe up on the app preview card to remove it from the list
- Press the home button when done.
4. If still a problem restore with your backup.
5. If still a problem restore as new, i.e. without your backup. See how it runs with nothing synced to it.
6. If still a problem, it's likely a hardware issue. -
hi guys i have an ipad 1 and when i plug it in to my macbook pro picasa opens up and show its name but when i open itunes i cant find the name, ive been working my head out to solve the problem please help me:(
Pay no attention to iinami, the amount of replies to people saying their handsets must have been jailbroken everytime iTunes throws out an error is tremendous. (Clearly you don't need to have any real knowledge to get to level 3 on these forums, let's hope apple's geniuses know a lot more than some of their customers.)
http://support.apple.com/kb/TS3694
Solution below.
Error 9
This error occurs when the device unexpectedly loses its USB connection with iTunes. This can occur if the device is manually disconnected during the restore process. This issue can be resolved by performing USB troubleshooting, using a different USB dock-connector cable, trying another USB port, restoring on another computer, or by eliminating conflicts from third-party security software. -
I have the iPhone 4 recently became weak Wi-Fi where I can not use the Internet only when sitting Bejjani router, Can anyone help me in solving this problem please
iPhone 4, iOS 7.0.3There's a whole lot to read in your post, and frankly I have not read it all.
Having said that, this troubleshooting guide should help:
http://support.apple.com/kb/TS1538
In particular, pay attention to the mobile device support sections near the bottom, assuming you have already done the items above it. -
Scholar92 - Strange error Need help please
Lecori Salutem
The program I have a problem with is supposed to extract info from a DB. It extracts the info perfectly but I cannot access the info with my get commands from other classes.
When i fire the program it says " [Ljava.lang.String;@1ba34f2 ". Can anyone help me to solve this problem please.
////////CODE STARTS HERE
import java.sql.*;
import javax.swing.*;
/** Description:
* Die program word gebruik om al die metadata en paths wat getabuleer is
* op die Music DB te access en te stoor.
* @author Benni( [email protected])
public class SQLImport
private Connection connSQL;
int tel = 2; // ID in SQL tabel begin by "2"
String [] tName = new String [100];
String [] tArtist = new String [100];
String [] tGenre = new String [100];
String [] tMood = new String [100];
String [] tPath = new String [100];
String [] tJavaPath = new String [100];
String [] tID = new String [100];
String [] tTime = new String [100];
public SQLImport( )
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connSQL = DriverManager.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=Music.mdb");
JOptionPane.showMessageDialog(null, "Connection Successfully Established", "Notification",JOptionPane.INFORMATION_MESSAGE);
catch (Exception sqlConnectionFailed)
JOptionPane.showMessageDialog(null, sqlConnectionFailed, "ERROR:",JOptionPane.ERROR_MESSAGE);
Statement statement = null;
try
statement = connSQL.createStatement( );
catch (SQLException statementERROR)
JOptionPane.showMessageDialog(null,statementERROR, "ERROR:",JOptionPane.ERROR_MESSAGE);
char optionChoice;
do
optionChoice = getMenuChoice();
if(optionChoice == 'A')
try
String querySQL = "SELECT * FROM tbl_ListedMusic ORDER BY ID ;";
System.out.println(querySQL);
ResultSet resultSet = statement.executeQuery(querySQL);
while (resultSet.next( ))
tID[tel] = resultSet.getString("ID");
tName[tel] = resultSet.getString("TrackName");
tArtist[tel] = resultSet.getString("TrackArtist");
tTime[tel] = resultSet.getString("TrackTime");
tGenre[tel] = resultSet.getString("TrackGenre");
tMood[tel] = resultSet.getString("TrackMood");
tJavaPath[tel] = resultSet.getString("TrackJavaPath");
tPath[tel] = resultSet.getString("TrackPath");
tel++;
catch (SQLException infoImportError)
JOptionPane.showMessageDialog(null,infoImportError, "ERROR:",JOptionPane.ERROR_MESSAGE);
while (optionChoice != 'X');
//NB! Strings are " " chars are ' '
public String[ ] gettID( )
return tID;
public String[ ] gettName( )
return tName;
public char getMenuChoice( )
String menu = "A) Import .mp3 info \n X) Exit";
char choice = JOptionPane.showInputDialog(menu).toUpperCase( ).charAt(0);
return choice;
public static void main (String [ ] args)
SQLImport sql = new SQLImport( );
String [ ] blah = new String [10];
blah = sql.gettID();
System.out.println(blah);
//Code ENDS
How do I resolve the " [Ljava.lang.String;@1ba34f2 " ? Much apreciated
Regards,
BennuThis forum is about the Messaging Server email server and related products. I think you have posted this question in the wrong forum.
Maybe you are looking for
-
I have transferred all of the songs from the old iMac we own to a new one we just bought. I have already had one problem with the music as in some songs wouldn't play without me using sharing. So I took and old computer off the sharing network and al
-
Is Acrobat X pro compatible with Explorer 9?
I just installed Acrobat X in my computer runing Windows 7. The adobe toolbar does not appear on my explorer browser. What may be the problem? What do I need to do to make the adobe toolbar on the Explorer 9 browser? Thank you.
-
Need to extract userid and Line 1 information from CUCM
I'm trying to automate the extraction of userid, phone number, and device name using AXL. The query I have returns all lines associated with a device and I need only the information associated with the phones' Line 1 (since that's the user's persona
-
CC app list not working.
When I open creative cloud on my mac, it says there's a download error with my apps list. This happened as soon as I tried to install the trial for After Effects and I have tried restarting the client and the issue still persists, any help?
-
I am not able to restart or shut down my iMac for the past few days, since computer says, iTunes stopped shutting down. When I tried to manually quit the application, next moment it restarts. This has become a big nusance and I am fed up. But, all