Siduction Forum
Siduction Forum => Scripting & Kernelhacking => Topic started by: michaa7 on 2013/05/31, 13:54:18
-
I try to figure out whether some (texlive) packages had become obsolete or aren't built yet (the situation now lasts about a week). In the first case I can let them go, in the second case I can't.
I thought I could grep for "Replace" in the output of "apt-cache show texlive*"
apt-cache show texlive* | grep Replaces:
which actually shows that those files are *replaced*.
Unfortunately it does not show which package is the one which replaces some other one. And as "texlive*" covers more than the installed files I don't know which packages I need to install.
The flag "-H" should show the files name, but actually it shows "Standardeingabe" (I think this is "stdin") for all matches (probably due to the fact that the input is piped).
Does anybody has a clue how to extend the "code" such that it provides the name of the file/package which replaces "whatever".
-
You must escape the '*'
So use
apt-cache show 'texlive*' | grep Replaces
or
apt-cache show texlive\* | grep Replaces
To capture the name of the package you will probably have to resort to 'awk'.
-
Thanks!
Escaping might be the syntacticly clean version, but there is no difference in output no matter whether I escape or not.
As to 'awk', I'm *afraid* you are right, because it's japanees to me. I am completely lost with it.
-
{
if ( $0 ~ /Package:/ ) { package=$0 }
if ( $0 ~ /Replaces:/ ) { printf "%s %s\n\n",package,$0 }
}
save this somewhere.
Then run
apt-cache show texlive\* | awk -f <path-to-the-awk-script>
-
Thanks!
Meanwhile I solved this in an other way:
# apt-cache show texlive* | egrep "^Package|Replaces" | grep "Replaces" -B1
Not really elegant, but at my level of knowledge ;-) .
From what I read so far I feel awk would be a blind alley for me.
Do you know by chance an appropriate, but free manual for shell scripting for absolut beginners? The ones I found googeling did not explain at the right level. I need something explaining basics only (variables, loops), something for fools, something where I may have success with little steps?
-
THIS (http://tldp.org/LDP/abs/html/index.html) is the best guide thru bash. The problem is that bash is not as easy as it seems...
-
Thanks Geier0815.
I have now doubt it's the best ... for you. I will bookmarkt it and give it a try. Still, I'd like to find something for me where neither the first word is "Advanced" nor it actually being written for advanced users ...
I now give thisone a try and we'll see where it leads ...
http://tldp.org/LDP/Bash-Beginners-Guide/html/