[Solved] Parsing countries file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] Parsing countries file
# 1  
Old 09-18-2012
[Solved] Parsing countries file

Hi All
I would like to take contries for this file http://www.textfixer.com/resources/d...n-iso-html.txt and save it in another file with the following structure .
Afghanistan, Åland Islands , Albania, Algeria, American Samoa

Can anyone help me to do this ?
# 2  
Old 09-18-2012
Quote:
Originally Posted by molwiko
Hi All
I would like to take contries for this file http://www.textfixer.com/resources/d...n-iso-html.txt and save it in another file with the following structure .
Afghanistan, Åland Islands , Albania, Algeria, American Samoa

Can anyone help me to do this ?
try this..

Code:
awk -F "[<>]" '/<option/{ print $3}' ORS="," file


Last edited by pamu; 09-18-2012 at 06:16 AM..
This User Gave Thanks to pamu For This Post:
# 3  
Old 09-18-2012
Try..
Code:
awk -F "[<>]" '/<option/ { printf "%s,", $3 }' file

This User Gave Thanks to clx For This Post:
# 4  
Old 09-18-2012
Thanks your solutions are working !
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. What is on Your Mind?

UNIX field scope in European countries

Hi, I have been working in India since past 13 years and as per Indian IT culture, there will be saturation in Salary which barely matches with rising living costs in India. I am thinking to move/work in some other country for few years at least which help me financially plus technically. As of... (3 Replies)
Discussion started by: nightup2222
3 Replies

2. Forum Support Area for Unregistered Users & Account Problems

Trouble Registering? Countries or Regions Abusing Forums

The forums have been seeing a sharp increase in spam bots, forum robots, and malicious registrations from certain countries. If you have been directed to this thread due to a "No Permission Error" when trying to register please post in this thread and request permission to register, including... (1 Reply)
Discussion started by: Neo
1 Replies

3. Shell Programming and Scripting

merging two files where countries are repeated

I have gone through various posts in this forum but could not locate where the repeated columns are there .Hence posted this post. File 1(colon seperated file) =============== Abc : 1234 : London Def : 2456 : Paris Efg :1456 : Newyork Fgh : 1324 : Tokyo Hjk : 5829 : California Lmn :... (10 Replies)
Discussion started by: vakharia Mahesh
10 Replies

4. Shell Programming and Scripting

[solved] merging two files and writing to another file- solved

i have two files as file1: 1 2 3 file2: a b c and the output should be: file3: 1~a 2~b 3~c (1 Reply)
Discussion started by: mlpathir
1 Replies

5. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

6. Shell Programming and Scripting

Parsing file, yaml file? Extracting specific sections

Here is a data file, which I believe is in YAML. I am trying to retrieve just the 'addon_domains" section, which doesnt seem to be as easy as I had originally thought. Any help on this would be greatly appreciated!! I have been trying to do this in awk and mostly bash scripting instead of perl... (3 Replies)
Discussion started by: Rhije
3 Replies

7. UNIX for Dummies Questions & Answers

Script for parsing details in a log file to a seperate file

Hi Experts, Im a new bee for scripting, I would ned to do the following via linux shell scripting, I have an application which throws a log file, on each action of a particular work with the application, as sson as the action is done, the log file would vanish or stops updating there, the... (2 Replies)
Discussion started by: pingnagan
2 Replies

8. Shell Programming and Scripting

Finding & Moving Oldest File by Parsing/Sorting Date Info in File Names

I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves. Also, the script should only move a file from /exports to... (6 Replies)
Discussion started by: nikosey
6 Replies
Login or Register to Ask a Question