EDIT:
Solved by repeating the syntax ( s/'//; s/'//; s/'//; s/'//; s/'//; ).
you can do "s/'//g" to replace all occurances.... that's what you want... though I'd do "s/'/\'/g" so the single quotes remain...
]]>Now current has no error, but extra still has these:
Inserting extra descriptions in database....
SQL error: near "that": syntax error
SQL error: near "documents": syntax error
SQL error: near "'less'');": syntax error
SQL error: near "Game": syntax error
SQL error: near "for": syntax error
SQL error: near "game": syntax error
SQL error: near "an": syntax error
SQL error: near "s": syntax error
SQL error: near "'Vectoroids is based on the X-Window PDA game Agendaroids,'');": syntax error
SQL error: near "files": syntax error
SQL error: near "programs": syntax errorPackage datbase is ready.
Press enter to continue
EDIT:
Solved by repeating the syntax ( s/'//; s/'//; s/'//; s/'//; s/'//; ).
awk '{ print $1 }' desc.txt | while read LINE; do descp=`sed -n "/%DESC%/,$ { /%DESC%/ d; /^$/ Q; s/'/\\'/; p}" /var/lib/pacman/current/$LINE-*/desc`;
sqlite /etc/pacmenu/pacmenu.db "INSERT INTO desc (name,description) VALUES ('$LINE', '$descp');"
done
ie..
Dillon's Cron Daemon
LGPL'd re-implementation of Motif
A front-end for CORBA 2.2 IDL and Netscape's XPIDL
Roaring Penguin's Point-to-Point Protocol over Ethernet client
Tools to access a server's filespace and printers via SMB
The whois client by Marco d'Itri
(eliott@hermes ~)$ awk '{ print $1 }' desc.txt | while read LINE; do grep "'" /var/lib/pacman/current/$LINE-*/desc; done
Dillon's Cron Daemon
LGPL'd re-implementation of Motif
A front-end for CORBA 2.2 IDL and Netscape's XPIDL
Roaring Penguin's Point-to-Point Protocol over Ethernet client
Tools to access a server's filespace and printers via SMB
The whois client by Marco d'Itri
# Current
ls /var/lib/pacman/current/ >/etc/pacmenu/package.txt
cat /etc/pacmenu/package.txt | sed 's|/| |g' | sed 's|-([^-]*-[^-]*)$| 1|g' >/tmp/desc.tmp
echo -e "${YELLOW}Inserting current descriptions in database....${NORMAL}"
awk '{ print $1 }' /tmp/desc.tmp | while read LINE; do
descp=`sed -n "/%DESC%/,$ { /%DESC%/ d; /^$/ Q; p }" /var/lib/pacman/current/$LINE-*/desc | awk '{print $1, $2, $3, $4, $5, $6}`
sqlite /etc/pacmenu/pacmenu.db "INSERT INTO desc (name,description) VALUES ('$LINE', '$descp');"
done
I reduced the inserted descriptions to 6 columns. Many of the desc are too long when six words will do.
The following errors are not caused by sed synatx but sqlite when inserting the descriptions from /var/lib/pacman/. What may cause or how to hide the error messages?
Inserting current descriptions in database....
SQL error: near "s": syntax error
SQL error: near "d": syntax error
SQL error: near "s": syntax error
SQL error: near "s": syntax error
SQL error: near "s": syntax error
SQL error: near "Itri": syntax errorPackage datbase is ready.
Press enter to continue
hmmm, the only thing I'm not sure of... what happens if the description has embedded newlines - I don't know if it *can* happen, but I know the pacman source reads until it finds a blank line... so I guess it's possible
That's why I wrote the sed script: it quits (Q) when it sees a blank line thus it can handle a multiline desc.
]]># grep -1 "%DESC%" /var/lib/pacman/current/abiword-2.2.4-1/desc
(shows one line above and under)
How to get one line under only without showing the matched pattern (%DESC%)?
]]>sqlite3 /etc/pacmenu/pacmenu.db "SELECT name FROM pkgs" > /tmp/pkg.tmp
cat /tmp/pkg.tmp | while read LINE; do
desc=`sed -n "/%DESC%/,$ { /%DESC%/ d; /^$/ Q; p }" /var/lib/pacman/*/$LINE*/desc`
sqlite3 /etc/pacmenu/pacmenu.db "INSERT INTO desc (name,description) VALUES ('$LINE', '$desc');"
done
sqlite3 /etc/pacmenu/pacmenu.db "SELECT name FROM pkgs" > /tmp/pkg.tmp cat /tmp/pkg.tmp | while read LINE; do sed -n "/%DESC%/,$ { /%DESC%/ d; /^$/ Q; p }" /var/lib/pacman/*/$LINE*/desc done
Do you mean something like:
cat /tmp/pkg.tmp | while read LINE; do
desc=`sed -n "/%DESC%/,$ { /%DESC%/ d; /^$/ Q; p }" /var/lib/pacman/*/$LINE*/desc`
sqlite3 "INSERT $LINE, $desc INTO some table"
done
Whatever the sqlite insert syntax is. You might be better off writing a conversion script in Python or Perl.
Can a package be in multiple groups?
%GROUPS%
xfce4