User Tools

Site Tools


resources:emacs_resources

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
resources:emacs_resources [2016/01/18 19:30] anthonyresources:emacs_resources [2019/05/22 16:08] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Emacs Resources ======
 +
 +\\
 +
 ====== Regular expressions ====== ====== Regular expressions ======
  
Line 68: Line 72:
 ---- ----
  
 +==== Add line break (RETURN) to end of all lines ====
  
-==== Sort article lists by year using awk and sed ====+[Put another way: insert spaces, insert empty line in between every line.]
  
-[Originally from Anthony's ''science.txt'' file, entry dated 2015-07-18.] +<code> 
- +M-x replace-regexp  
-Exported bibliography to clipboard in Zotero, pasted into Emacs to write new file:  +.$[RET
- +\&[C-q][C-j][RET]
-''.../VNLab/studies/ipsNumMeta/sources_number.txt'' +
- +
- +
-Try using awk to print column with year before whole rest of line +
- +
-<code bash> +
-$ gawk '{match($0,"\\([0-9]*[a-z]?\\)",a)} {print a[0], $0}' sources_number.txt > sources_number_yearCol.txt+
 </code> </code>
  
-Remove parens from FIRST (year) on a line:+"\&" is the emacs pattern that stands for "the entire matched pattern"
  
-<code bash> +C-q indicates something like "insert the following input literally" (I remember it by thinking of this as "quoting" something).
-sed -r 's/[(]([0-9]*[a-z]?)[)]/\1/' sources_number_yearCol.txt > sources_number_yearCol_noParens.txt +
-</code>+
  
-Used rectangle register copy trick in Emacs to copy only first five chars (catches both 2012 and 2012band pasted ultimately to Excel column.+C-j inserts a line break (a RETURN keypress, but this might not be the most precise description).
  
 \\ \\
 ---- ----
- 
resources/emacs_resources.1453163401.txt.gz · Last modified: (external edit)