09-06-2008
Easy unix/sed question that I could have done 10 years ago!
Hi all and greetings from Ireland!
I have not used much unix or awk/sed in years and have forgotten a lot.
Easy enough query tho.
I am cleansing/fixing 10,000 postal addresses using global replacements.
I have 2 pipe delimited files , one is basically a spell checker for geographical areas. The second file is actual addresses.
Sample file 1 - 100+ lines (basically a spell checker):
|Irlllland|Ireland|
|Dubblin|Dublin|
|Corrk|Cork|
etc..
Sample file 2 - 10,000+ lines (Addresses to be cleansed):
|10 Main Street Irlllland|
|11 High Road Irlllland|
|1 High Road, Corrk|
The output required is :
|10 Main Street Ireland|
|11 High Road Ireland|
|1 High Road, Cork|
I am very rusty but reckon I need a loop with a global substition in it.
I used to know unix, awk and sed reasonably well but have forgotten the basic syntax.
All helpers there?
8 More Discussions You Might Find Interesting
1. Cybersecurity
Hi,
Could anyone direct me to any sites that have any info on unix attcks or hacks in the last 5 years. This is needed for an assignment. All help would be greatly appreciated.
Thanks:) (6 Replies)
Discussion started by: suzant
6 Replies
2. UNIX for Dummies Questions & Answers
can anyone tell me what exactly the following UNIX notation code does cause I need to do the same in windows?
for x in webapps/sal/*.htm*
do
mv $x $x.bak
sed 's@bob@sal@g' $x.bak > $x
done
Thanks (1 Reply)
Discussion started by: lavaghman
1 Replies
3. UNIX for Dummies Questions & Answers
I am trying to check through all of a certain type of file in all main directories, and find the top 10 that are taking up the most space. How can I do that? I was thinking like du *.file | sort -n | head (1 Reply)
Discussion started by: wallacer
1 Replies
4. Shell Programming and Scripting
I have a file name in this format
ABC_WIRE_TRANS_YYYYMMDD_00.DAT
I need to cut out the _00 out of the file name everytime. It could be _00, _01,_02, etc ....
How do I cut it out to look as follows?
ABC_WIRE_TRANS_YYYYMMDD.DAT (6 Replies)
Discussion started by: lesstjm
6 Replies
5. UNIX for Dummies Questions & Answers
I have a line like:
"Jun 19 12:56:22 routername 45454:"
I want to keep all information except the seconds of the time. I tried:
sed 's/..:..:../..:../g'
but apparently I'm on the wrong track, because although that matches on the time, it replaces it with the literal ..:..
How... (6 Replies)
Discussion started by: earnstaf
6 Replies
6. UNIX for Dummies Questions & Answers
Hi everybody:
Could anybody tell me if I have several files which each one it has this pattern name:
name1.dat name2.dat name3.dat name4.dat name10.dat name11.dat name30.dat
If I would like create one like:
name_total.dat
If I do:
paste name*.dat > name_total.dat (15 Replies)
Discussion started by: tonet
15 Replies
7. UNIX for Dummies Questions & Answers
Hello - I have a folder that contains files from 2003 till 2010. I am trying to figure out a command that would seperate each years file and show me a count?
Even if i can find a command that would give me year by year count, thats good enough too.
Thanks (8 Replies)
Discussion started by: DallasT
8 Replies
8. What is on Your Mind?
From Wed Sep 4 09:35 MDT 1991
Received: from by with SMTP
(16.6/15.5+IOS 3.20) id AA25932; Wed, 4 Sep 91 09:35:27 -0600
Return-Path:
Received: by
(16.6/15.5+IOS 3.20) id AA10424; Wed, 4 Sep 91 09:34:58 -0600
Date: Wed, 4 Sep 91 09:34:58 -0600
From:
Message-Id: <>
To: ... (0 Replies)
Discussion started by: jpezz
0 Replies
LEARN ABOUT DEBIAN
graph::easy::layout::repair
Graph::Easy::Layout::Repair(3pm) User Contributed Perl Documentation Graph::Easy::Layout::Repair(3pm)
NAME
Graph::Easy::Layout::Repair - Repair spliced layout with group cells
SYNOPSIS
use Graph::Easy;
my $graph = Graph::Easy->new();
my $bonn = Graph::Easy::Node->new(
name => 'Bonn',
);
my $berlin = Graph::Easy::Node->new(
name => 'Berlin',
);
$graph->add_edge ($bonn, $berlin);
$graph->layout();
print $graph->as_ascii( );
# prints:
# +------+ +--------+
# | Bonn | --> | Berlin |
# +------+ +--------+
DESCRIPTION
"Graph::Easy::Layout::Repair" contains code that can splice in group cells into a layout, as well as repair the layout after that step.
It is part of Graph::Easy and used automatically.
METHODS
"Graph::Easy::Layout" injects the following methods into the "Graph::Easy" namespace:
_edges_into_groups()
Put the edges into the appropriate group and class.
_assign_ranks()
$graph->_assign_ranks();
_repair_nodes()
Splicing the rows/columns to add filler cells will have torn holes into multi-edges nodes, so we insert additional filler cells to repair
this.
_splice_edges()
Splicing the rows/columns to add filler cells might have torn holes into multi-celled edges, so we splice these together again.
_repair_edges()
Splicing the rows/columns to add filler cells might have put "holes" between an edge start/end and the node cell it points to. This routine
fixes this problem by extending the edge by one cell if necessary.
_fill_group_cells()
After doing a "layout()", we need to add the group to each cell based on what group the nearest node is in.
This routine will also find the label cell for each group, and repair edge/node damage done by the splicing.
EXPORT
Exports nothing.
SEE ALSO
Graph::Easy.
AUTHOR
Copyright (C) 2004 - 2007 by Tels <http://bloodgate.com>
See the LICENSE file for information.
perl v5.14.2 2011-12-23 Graph::Easy::Layout::Repair(3pm)