Sponsored Content
Top Forums Shell Programming and Scripting Inserting lines from one file to a sorted list Post 302877339 by danbroz on Friday 29th of November 2013 10:59:16 PM
Old 11-29-2013
Inserting lines from one file to a sorted list

Hello friends! I am working a Psychology/Neuro* project where I am sorting inline citations by category. The final step of the process has me a little stuck. I need to take citations from a text list and sort them in another text file.


Here is a file X example
---------------------------------------------------------------------------------------
Code:
Another study found that among patients with schizophrenia, the greater the amount of D2 receptor activation in the prefrontal cortex, the greater the cognitive  impairment (Meyer-Lindenberg et al., 2002)

Schizophrenia is associated with lower than normal release of glutamate and fewer than normal receptors in the prefrontal cortex and hippocampus (Akbarian et al., 1995;Ibrahim et al., 2000; Tsai et al., 1995).

PCP is Chapter 15 Mood Disorders and Schizophrenia is an interesting model for schizophrenia in other regards also (Farber, Newcomer, & Olney, 1999; Olney & Farber, 1995)

----------------------------

This is file Y before running the script:

Code:
schizophrenia

D2

prefrontal

impairment

hippocampus

PCP

------------------------
Code:
schizophrenia
Another study found that among patients with schizophrenia, the greater the amount of D2 receptor activation in the prefrontal cortex, the greater the cognitive  impairment (Meyer-Lindenberg et al., 2002)

Schizophrenia is associated with lower than normal release of glutamate and fewer than normal receptors in the prefrontal cortex and hippocampus (Akbarian et al., 1995;Ibrahim et al., 2000; Tsai et al., 1995).

PCP is Chapter 15 Mood Disorders and Schizophrenia is an interesting model for schizophrenia in other regards also (Farber, Newcomer, & Olney, 1999; Olney & Farber, 1995)

D2
Another study found that among patients with schizophrenia, the greater the amount of D2 receptor activation in the prefrontal cortex, the greater the cognitive  impairment (Meyer-Lindenberg et al., 2002)

prefrontal
Another study found that among patients with schizophrenia, the greater the amount of D2 receptor activation in the prefrontal cortex, the greater the cognitive  impairment (Meyer-Lindenberg et al., 2002)

Schizophrenia is associated with lower than normal release of glutamate and fewer than normal receptors in the prefrontal cortex and hippocampus (Akbarian et al., 1995;Ibrahim et al., 2000; Tsai et al., 1995).

impairment
Another study found that among patients with schizophrenia, the greater the amount of D2 receptor activation in the prefrontal cortex, the greater the cognitive  impairment (Meyer-Lindenberg et al., 2002)

hippocampus
Schizophrenia is associated with lower than normal release of glutamate and fewer than normal receptors in the prefrontal cortex and hippocampus (Akbarian et al., 1995;Ibrahim et al., 2000; Tsai et al., 1995).

PCP
PCP is Chapter 15 Mood Disorders and Schizophrenia is an interesting model for schizophrenia in other regards also (Farber, Newcomer, & Olney, 1999; Olney & Farber, 1995)

---------------------------------------------------------------------------------------

Trying to figure it out through google results, I made this mess ;
Code:
awk /X.txt/ '{ print; print grep <word++>  -R -Hn Y.txt; next }1'

Thank you everyone even if you only read this.

Last edited by Scrutinizer; 11-30-2013 at 07:52 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Trying to get list of logged on users sorted

I'm trying to execute a single shell command that will give me a sorted list of all the users currently logged into the system, displaying the users name as it appears in /etc/passwd. I've tried awk -F: '{print $1}' /etc/passwd | xargs finger -s | cut -c11-28 | uniq This list whoever does... (7 Replies)
Discussion started by: kungfuice
7 Replies

2. UNIX for Dummies Questions & Answers

Inserting in sorted rows

Hello Friends, I have a file with many many rows and I want to insert some numbers in between numbers. The number must be inserted in "correct sorted order". 1. Input = 1055555 0000001 1000000 1055555 <-insert here 3000000 4000000 5000000 8000000 2. Input = 4000080 0000001... (1 Reply)
Discussion started by: buddyme
1 Replies

3. Shell Programming and Scripting

inserting a lines in a file

Hi folks, i need to insert the same set of lines between each line input lines 111111 aaaaaa 333333 output should be 111111 1 2 3 aaaaaa 1 2 3 333333 1 (2 Replies)
Discussion started by: Balaji Sukumara
2 Replies

4. Shell Programming and Scripting

Inserting lines in between the contents of file.

Hi, I want to insert some lines in between the contents of a file but the file format should not be changed. #!/usr/bin/sh - # Link appropriate OS specific versions of vxicap and vxchk4badblks vxlvmlink() { vxipath=/usr/lib/vxvm/bin relmajor=`uname -v` ... (1 Reply)
Discussion started by: ajilesh
1 Replies

5. Shell Programming and Scripting

Sorted list by time of spu processing

Hi, i have to make a command in unix system which make a sorted list by cpu time (not %cpu ). If the application exists more than a time I would like to keep only one copy. Could you help me please ??? P.s : I am trying --> ps aux --sort -%cpu | uniq but I understand that is wrong (5 Replies)
Discussion started by: petros55
5 Replies

6. Shell Programming and Scripting

How to get a very big file sorted by contents of another variable list in one pass?

I have two list.... One has 17m (yes that's million) records in it which relate to the path and file name of individual text files. At the start of the pathname is a two character identifier identifying which category it belongs in as identified by a second file with the two character lookup... (10 Replies)
Discussion started by: Bashingaway
10 Replies

7. Shell Programming and Scripting

Match and insert in a sorted list

I have a sorted list (python) and I want to insert a string if it matches the pattern in list. Example : Sorted List Above list is in sorted order. I need to insert a name in sorted order and also if the name already exist then it should be inserted before the existing... (1 Reply)
Discussion started by: pratapsingh
1 Replies

8. UNIX for Advanced & Expert Users

Inserting duplicate lines in a file

Hi, I copied the contents of a binary file into a .text file using hd (hexdump) command. The data in binary file is such that I get in many places like following 00000250 00 00 00 00 3f 2d 91 68 3f 69 fb e7 00 00 00 00 |....?-.h?i......| 00000260 00 00 00 00 00 00 00 00 00 00 00 00 00... (2 Replies)
Discussion started by: KidD312
2 Replies

9. Homework & Coursework Questions

Display sorted list using sed command

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a command line that will display a sorted list of logged in users. Just display the username and no other... (5 Replies)
Discussion started by: kofine05
5 Replies

10. Shell Programming and Scripting

Merging multiple lines to columns with awk, while inserting commas for missing lines

Hello all, I have a large csv file where there are four types of rows I need to merge into one row per person, where there is a column for each possible code / type of row, even if that code/row isn't there for that person. In the csv, a person may be listed from one to four times... (9 Replies)
Discussion started by: RalphNY
9 Replies
All times are GMT -4. The time now is 06:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy