Greping summaries of academic citations


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Greping summaries of academic citations
# 8  
Old 11-11-2012
Is there a way to include the sentence before the citation?
# 9  
Old 11-11-2012
Yes, instead of the -A5 option you used before try -B5. AND, read the man page.
BTW, this would not yield the sentence but the last 5 lines before. If you go for the sentence, this will become awkward...
This User Gave Thanks to RudiC For This Post:
# 10  
Old 11-11-2012
This regex seems to also return the required output:

Code:
grep -o "([^)]\+ [0-9]\{4\})" file

But it will fail on the citations spread on multiple lines as in:
Quote:
symptoms of schizophrenia, and they are now
used more widely ( J. M. Davis, Chen, & Glick,
Compared to drugs like haloperidol, the second-generation
2003; Edlinger et al., 2005)
. Clozapine is generally considantipsychotics
Suggestion, first get rid of all CR before running the grep thing.

Edit:
Try this:
Code:
tr -d '\n' < file | grep -o "([^)(]\+ [0-9]\{4\})"


Last edited by ripat; 11-11-2012 at 05:49 AM.. Reason: Ammended snippet
This User Gave Thanks to ripat For This Post:
# 11  
Old 11-12-2012
I saw on anther board:
"awk '/word1/', will print out the whole sentence, when I need just a word1."

I would love to have that kind of problem. Putting in user ripat's awesome regular expression
Code:
tr -d '\n' < BioPsych10.txt | awk /'([^)(]\+ [0-9]\{4\})/'

returns nothing.

I think it is interrupting it as text and not as regular expression.

Last edited by danbroz; 11-12-2012 at 01:48 PM.. Reason: moved '
# 12  
Old 11-12-2012
How far do you get with the -B5 option?
# 13  
Old 11-12-2012
B5 cuts some sentences short or leaves a lot of garbage.

It was implied that I can get just the sentence and the citation using awk. Digging through the man page and google searches implied that
Code:
awk '/word1/'

spit out the whole sentence. Does anyone know if I can do that with regular expressions? I tried in my previous post.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Latex/Bibtex - Error of no match for citations?

I'm trying to add citations to this latex formatted paper. I know the bibtex file is causing the issue. I will try to use this document as a reference once I have a working version. If anyone has an idea what these errors could mean that would help immensely. Any ideas how to fix would also be... (0 Replies)
Discussion started by: D2K
0 Replies

2. Shell Programming and Scripting

greping $2 into a list

Hi When I run this command: lsuser -a auditclasses ALL I got: user1 auditclasses=general,objects,cron,files,rbac,audit,lvm,aixpert user2 auditclasses=general,objects,cron,files,rbac,audit,lvm,aixpert user3 auditclasses=general,objects,cron,files,rbac,audit,lvm,aixpert user4... (7 Replies)
Discussion started by: iga3725
7 Replies

3. Shell Programming and Scripting

need help in greping

Hi, i have to find a string in a file and positin of the string in the file would come in some particular interval. let's say file is 1-1000 lines and string is in from 200-300line. could any one suggest me how to get make the grep search for the string in that particular portion of the... (4 Replies)
Discussion started by: tarakant
4 Replies

4. Shell Programming and Scripting

Greping in between two different lines.

I know you could use the grep "something" -A200 flag to get all the lines past your pattern. Is there a way to get all the lines in between two patterns? The -a flag will not work since all lines in between the two patterns don't have a constant number. (4 Replies)
Discussion started by: jwillis0720
4 Replies

5. Shell Programming and Scripting

greping ip address

I have this line BTSRTRGRP-448-1-1 10.162.141.118/255.255.255.254 - I need to print only the IPADDRESS and not the subnet mask. If i use cut -c30-43 I get the ipaddress, where as in some cases if the last octet is of single digit (10.162.141.8/255.255.255.254) it... (2 Replies)
Discussion started by: miltonrods
2 Replies

6. Red Hat

Rebuilding C++ Libraries to save Linux install (purely academic question)

The crisis is over. I am just doing postmortem on how we handled it. So this is just an exercise in academics. We have a mission critical system running on RED Hat Linux. It is a turnkey system "managed 100% by the vendor". I put this is quotes because we had an event last night that... (0 Replies)
Discussion started by: Skyybugg
0 Replies

7. Shell Programming and Scripting

need help in greping

i have a ksh script : #!/bin/ksh TZ=`date +%Z`+24 ;a=`date +%Y-%m-%d` b=`date +"%H:%M:%S"` cd /ednadtu3/u01/pipe/logs for i in Archiver1.log do cat $i | grep $a | grep $b >> /ednadtu3/u01/pipe/naveed/Insert_Date.txt done... (4 Replies)
Discussion started by: ali560045
4 Replies

8. UNIX for Dummies Questions & Answers

Help with greping a field

Hi, Suppose I have a file as below and I just want the field Invoice Number from this file , How can I do it. /home/arbor>cat PH0034090202314800030IM-001 0Yp825XMilperra NSW 1891 189110H14V1Sp2871Yp300X Customer Service : 0000-368-81118H6.5V0Sp3130Yp50X ... (7 Replies)
Discussion started by: rooh
7 Replies
Login or Register to Ask a Question