Posts Tagged ‘terminal’
Nokia N9 – How to install the terminal application
If you want to get access to the terminal application, you can simply do the following: go to Settings -> Security -> Developer mode and enable it. The terminal will be automatically installed. Enjoy 🙂
Extracting citations from a BibTex file using Linux terminal
I had a big (around 40 entries) BibTex file with the references of some papers I studied and I wanted to extract the citations in the format used for citing in Latex (\cite{AuthorYear}
). Just today I read some tutorials about awk
, so I thought “Let’s use it!!”.
An example BibTex file:
@article{Kotselidis2010, author = {Kotselidis, Christos and Lujan, Mikel and Ansari, Mohammad and Malakasis, Konstantinos and Kahn, Behram and Kirkham, Chris and Watson, Ian}, doi = {10.1109/IPDPS.2010.5470460}, isbn = {978-1-4244-6442-5}, journal = {2010 IEEE International Symposium on Parallel \& Distributed Processing (IPDPS)}, pages = {1--12}, publisher = {Ieee}, title = {{Clustering JVMs with software transactional memory support}}, url = {http://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?arnumber=5470460}, year = {2010} } @phdthesis{Zhang2009c, author = {Zhang, Bo}, keywords = {cache-coherence,contention manager,distributed transactional memory}, title = {{On the Design of Contention Managers and Cache-Coherence Protocols for Distributed Transactional Memory}}, year = {2009} } |
Solution
awk 'BEGIN{FS="[{,]"} /@/ {print "\\cite{"$2"}"}' filename.bib |
\cite{Zhang2009c}
\cite{Kotselidis2010}
In order to save the output in a file named cites.txt
:
awk 'BEGIN{FS="[{,]"} /@/ {print "\\cite{"$2"}"}' filename.bib > cites.txt |
Hint: Use “>>
” if you want to append the output. Single >
creates a new file (if not existing), or empties the existing one and then appends the content..
If you want to know my “implementation” process, continue reading 😉
Read the rest of this entry »