I have a txt file of information about journal articles from different fields. I need to convert this information into a format that is easier for computers to manipulate for some research that I'm doing on how articles are cited. The file has some header information and then details of records. For example,
Code:
Tue Jun 19 14:07:34 EDT 2012
CSA
Database: EconLit
Record 1 of 500
DN: Database Name
EconLit
TI: Title
Statistical Modeling of Monetary Policy and Its Effects
AU: Author
Sims, Christopher A
SO: Source
American Economic Review, vol. 102, no. 4, June 2012, pp. 1187-1205
DE: Descriptors
History of Economic Thought: Macroeconomics (B220); Economic
Methodology (B410); Methodological Issues: General (C180); Business
Fluctuations, Cycles (E320); Prices, Business Fluctuations, and
Cycles: Forecasting and Simulation: Models and Applications (E370);
Monetary Policy (E520); Modeling; Monetary; Monetary Policy; Policy
PY: Publication Year
2012
Record 2 of 500
DN: Database Name
EconLit
TI: Title
Targeting the Poor: Evidence from a Field Experiment in Indonesia
AU: Author
Alatas, Vivi; Banerjee, Abhijit; Hanna, Rema; Olken, Benjamin A;
Tobias, Julia
SO: Source
American Economic Review, vol. 102, no. 4, June 2012, pp. 1206-40
DE: Descriptors
Field Experiments (C930); Measurement and Analysis of Poverty (I320);
Welfare and Poverty: Government Programs, Provision and Effects of
Welfare Programs (I380); Microeconomic Analyses of Economic
Development (O120); Economic Development: Human Resources, Human
Development, Income Distribution, Migration (O150); Economic
Development: Urban, Rural, Regional, and Transportation Analysis,
Housing, Infrastructure (O180); Urban, Rural, Regional, and
Transportation Economics: Regional Migration, Regional Labor Markets,
Population, Neighborhood Characteristics (R230); Indonesia; Asia;
Experiment; Experiments; Field Experiment; Poor; Poverty; Village
PY: Publication Year
2012
.
.
.
My goal is to convert this information into CSV format like so:
"Statistical Modeling of Monetary Policy and Its Effects","Sims, Christopher A","American Economic Review, vol. 102, no. 4, June 2012, pp. 1187-1205","B220,B410,C180,E320,E370,E520",2012
"Targeting the Poor: Evidence from a Field Experiment in Indonesia","Alatas, Vivi; Banerjee, Abhijit; Hanna, Rema; Olken, Benjamin A; Tobias, Julia","American Economic Review, vol. 102, no. 4, June 2012, pp. 1206-40","C930,I320,I380,O120,O150,O180,R230",2012
Note that there are some descriptors that do not have codes, (eg. `Modeling' at the end of the first record). The code needs to drop those descriptors and only include the 4 character/numeric codes in brackets.
I am certain this is a fairly simple task for either awk or sed, but I don't know either with the proficiency that I should. I'd be grateful if someone can out with this.
Last edited by Scrutinizer; 07-15-2012 at 02:58 PM..
Reason: quote tags => code tags plus extra
HI guys,
I have created a script to read 1 column in a csv file and then place it in text file.
However, when i checked out the text file, it is not in a column format...
Example:
CSV file contains
name,age
aa,11
bb,22
cc,33
After using awk to get first column
TXT file... (1 Reply)
Hi,
Using rsync, I've sent the output to a text file. This is the text file :
Pls help me on converting this text file to a csv file. Probably a script or sth to convert the text file to a csv file. (3 Replies)
HI All,
I have a text file memory.txt which has following values.
Average: 822387 7346605 89.93 288845 4176593 2044589 51883 2.47 7600
i want to convert this file in csv format and i am using following command to do it.
sed s/_/\./g <... (3 Replies)
Hi,
I have a filename.csv in which there are 3 colums, ie:
Name ; prefixnumber ; number
root ; 020 ; 1234567
user1,2,3 ; 070 ; 7654321
What I want is to merge colum 2 and 3 that it becomes 0201234567 or even better +31201234567 so the country number is used and drop the leading 0.... (9 Replies)
Hello,
I have an output file showing database sizes across the 3 environments that I use (LIVE, TEST & DEVELOPMENT).
I am trying to write a script that lets me know if the size of a db on one environment is different to its corresponding db on the other environments.
Here is an example... (4 Replies)
Hi,
I want to print two columns from a .txt file to a .csv file using awk.
data in text file:
Application
-------------------------------------------------- -----------
OS Related Issues 1
EMEA Solutions ... (8 Replies)
Hi,
I have a xml script, I converted it to .txt with values comma seperated using awk function. But I want the output values should be inside double quotes
My xml script (Workorders.xml) is shown like below:
<?xml version="1.0" encoding="utf-8" ?>
<scbm-extract version="3.3">... (8 Replies)
Hi dears
i have text file like this:
INPUT.txt
001_1_173 j nuh ]az
001_1_174 j ]esma. nuh ]/.xori
.
.
. and have another text
like this
TABLE.txt
j j
nuh word1... (6 Replies)