Results 1 to 1 of 1
I'm trying to add all ubuntu packages list to an sqlite database.
Everything works out perfectly, I wget http://archive.ubuntu.com/ubuntu/dis...6/Packages.bz2 and I managed to make each line as an INSERT command.
...
- 06-14-2008 #1Just Joined!
- Join Date
- Jun 2008
- Location
- Serbia
- Posts
- 3
problem checking/adding lines - sed?
I'm trying to add all ubuntu packages list to an sqlite database.
Everything works out perfectly, I wget http://archive.ubuntu.com/ubuntu/dis...6/Packages.bz2 and I managed to make each line as an INSERT command.
The problem is that some parts of the list aren't always shown, specifically after "Version:"
and after "Origin:"Replaces:
Provides:
Depends:
Recommends:
Suggests:
Conflicts:
e.g. I need to add "Replaces:" in a new line after a line that starts with "Version:" only if there isn't such a line (that begins with "Replaces:")Task:
I've tried a sed script, but I think I have it all wrong:
I've attached a small sample of the packages.bz2 (uncompressed) for you to play with.Code:s/"/'/g :replaces s/Replaces: /","/g t provides T addreplaces :addreplaces /Version:/ a\ Replaces: :provides s/Provides: /","/g t depends T addprovides :addprovides /Replaces:/ a\ Provides: :depends s/Depends: /","/g t next T adddepends :adddepends /Version:/ a\ Depends: :next
Thanks in advance!


Reply With Quote