Sponsored Content
Top Forums Shell Programming and Scripting to extract specific values twice in a file Post 302344177 by durden_tyler on Friday 14th of August 2009 08:11:01 PM
Old 08-14-2009
Quote:
Originally Posted by techmoris
...
I would like to extract all the 2nd column values twice as shown in the example like
12345,12345.xml
04567,04567.xml
12134,12134.xml
...
In the formus one of our friends adviced me in fetching the 2nd column values

awk -F'[.|,]' '{print $3}' oldfile > newfile
Well, that awk script answers your question for the most part.

Play around a bit with that script (it doesn't bite), and you'll find the solution.

For example, check the token values - $1, $2, etc. Also see if you can print the same token value twice.

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract values from log file

I would like to write a shell script that will parse through a file similar to the sample below. The data in the file is redirected from rsync into a log file. I would like to call a shell script to parse through and pick out the number beside the percent sign inside the parentheses in the last... (5 Replies)
Discussion started by: wdympcf
5 Replies

2. Shell Programming and Scripting

to extract specific value in a file

Hi Friends, I have a file with the following values.. xyz.txt,12345.xml abc.txt,04567.xml cde.txt,12134.xml I would like to extract all the 2nd column values like 12345 04567 12134 Please advice!! (3 Replies)
Discussion started by: techmoris
3 Replies

3. UNIX for Dummies Questions & Answers

Extract Unique Values from file

Hello all, I have a file with following sample data 2009-08-26 05:32:01.65 spid5 Process ID 86:214 owns resources that are blocking processes on Scheduler 0. 2009-08-26 05:32:01.65 spid5 Process ID 86:214 owns resources that are blocking processes on Scheduler 0. 2009-08-26... (5 Replies)
Discussion started by: simonsimon
5 Replies

4. Shell Programming and Scripting

Extract specific lines from a file

Hi, I have a file which contains DDL statements- CREATE TABLE, CREATE INDEX, ALTER TABLE etc. I have to only pick CREATE TABLE statements from the file- Source : ---------------------------------------------- --DDL for table abc -------------------------------------------- CREATE TABLE... (4 Replies)
Discussion started by: newb
4 Replies

5. Shell Programming and Scripting

Extract values from an XML File

Hi, I need to capture all the attributes with delete next to it. The source XML file is attached. The output should contain something like this below: Attributes = legacyExchangeDN Action = Delete Username = Hero Joker Loginid = joker09 OU =... (4 Replies)
Discussion started by: prvnrk
4 Replies

6. Shell Programming and Scripting

Extract a specific string from a file

Hi, I have a file whose contents are as follows. 2013-03-08/15:09:20.134 INFO 00000000-00000000 0034 09700400 CON_IN SessionID:ED5E1400-4805-85E2-17B2-5BE45684886A Connection ID:ED5E1400-4805-68F1-BB1D-F06496BCF910 TO:<sip:51234999@10.239.94.146:5060 FROM:<sip:9302280716@97.208.31.7:51024... (2 Replies)
Discussion started by: SunilB2011
2 Replies

7. Shell Programming and Scripting

Extract values from a specific column to the end

Hello friends, I have a text file with many columns (no. columns vary from row to row) separated by space. I need to collect all the values from 18th column to the end from each line and group them as pairs and then numbering like below.. 1. 18th-col-value 19th-col-value 2. 20th-col-value ... (5 Replies)
Discussion started by: prvnrk
5 Replies

8. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

9. Shell Programming and Scripting

Get specific values from a file, help

Dear all, I have a specific problem that i cannot solve and I hope someone here can help me. :) I have two text files with one column of values. Example: File1: 67 94 95 . . File2 0.1 0.003 0.5 . . (3 Replies)
Discussion started by: Higgo
3 Replies

10. Shell Programming and Scripting

awk to match file1 and extract specific tag values

File2 is tab-delimeted and I am trying to use $2 in file1 (space delimeted) as a search term in file2. If it is found then the AF= in and the FDP= values from file2 are extracted and printed next to the file1 line. I commented the awk before I added the lines in bold the current output resulted. I... (7 Replies)
Discussion started by: cmccabe
7 Replies
ISOQUERY(1)															       ISOQUERY(1)

NAME
isoquery - Search and display various ISO codes (country, language, ...) SYNOPSIS
isoquery [options] [file] [ISO codes] DESCRIPTION
This manual page documents briefly the isoquery command. It can be used to generate a tabular output of the ISO standard codes provided by the package iso-codes. It parses the XML files and shows all included ISO codes or just matching entries, if specified on the command line. Moreover, it's possible to get all available translations for the ISO standard. OPTIONS
This program follows the usual GNU command line syntax, with long options starting with two dashes ('-'). isoquery supports the following options: -i standard, --iso=standard The ISO standard to use. Possible values: 639, 639-3, 3166, 3166-2, 4217, 15924 (default: 3166). -x file, --xmlfile=file Use another XML file with ISO data (default: /usr/share/xml/iso-codes/iso_3166.xml). -l locale, --locale=locale Use this locale for output. -n, --name Name for the supplied codes (default). -o, --official_name Official name for the supplied codes. This may be the same as --name (only applies to ISO 3166). -c, --common_name Common name for the supplied codes. This may be the same as --name (only applies to ISO 3166). -0, --null Separate entries with a NULL character instead of newline. -h, --help Show summary of options. -v, --version Show program version and copyright. EXAMPLES
If called without any command line options, isoquery will put out a table of all ISO 3166 codes. The first three columns contain the alpha-2 code, the alpha-3 code, and the numerical code assigned to the country listed in the fourth column. $ isoquery AF AFG 004 Afghanistan [...] ZW ZWE 716 Zimbabwe If you need only some countries, you can specify any of the codes in the first three columns to cut down the output. $ isoquery so nor 484 SO SOM 706 Somalia NO NOR 578 Norway MX MEX 484 Mexico Should you need the translations of the countries' names, just specify in which locale you'd like to see the output. Please note that the original English name will be shown if there is no translation available for the specified locale. $ isoquery --locale=nl fr de es FR FRA 250 Frankrijk DE DEU 276 Duitsland ES ESP 724 Spanje All of the above works for different ISO standards as well, so you can switch to the more extensive standard ISO 3166-2 by using the --iso command line option. The columns are country code, subset type (e.g. State, Province, etc.), ISO 3166-2 code, parent, and name. The fourth column (parent) may be empty. $ isoquery --iso=3166-2 AD Parish AD-07 Andorra la Vella [...] ZW Province ZW-MI Midlands For ISO 639, the first three columns are the ISO 639 2B code, the ISO 639 2T code and the ISO 639-1 code. The third column may be empty. $ isoquery --iso=639 aar aar aa Afar abk abk ab Abkhazian ace ace Achinese [...] zun zun Zuni zxx zxx No linguistic content; Not applicable zza zza Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki You can trim down the results by specifying only some codes. Moreover, the option to get translated names is also available. $ isoquery --iso=639 --locale=pt vi bo kl vie vie vi Vietnamita tib bod bo tibetano kal kal kl Kalaallisut; Greenlandic If you want to use ISO 639-3, the displayed columns are id, scope, type, part 1 code, part 2 code, and the language name. Both part 1 and part 2 may be empty. $ isoquery -i 639-3 aal new spa guc aal I L Afade new I L new Bhasa, Nepal spa I L es spa Spanish guc I L Wayuu You can get selected translations of currency names from the ISO 4217 standard by using the following command. The first two columns are the alpha-3 code and the numerical code assigned to the currency. $ isoquery --iso=4217 --locale=da cad 392 CAD 124 Canadisk dollar JPY 392 Yen If you need to get script names, you can use the ISO 15924 table. The first two columns are the alpha-4 code and the numerical code assigned to the script. $ isoquery --iso=15924 jpan latn 280 Jpan 413 Japanese (alias for Han + Hiragana + Katakana) Latn 215 Latin Visp 280 Visible Speech FILES
By default, the XML files provided by the iso-codes package will be used. /usr/share/xml/iso-codes/iso_639.xml /usr/share/xml/iso-codes/iso_639_3.xml /usr/share/xml/iso-codes/iso_3166.xml /usr/share/xml/iso-codes/iso_3166_2.xml /usr/share/xml/iso-codes/iso_4217.xml /usr/share/xml/iso-codes/iso_15924.xml AUTHOR
Tobias Quathamer <toddy@debian.org> 1.7 2012-01-23 ISOQUERY(1)
All times are GMT -4. The time now is 02:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy