Search Results

Search: Posts Made By: sitney
1,604
Posted By sitney
What this GNU sed line will do is capture...
What this GNU sed line will do is capture everything EXCEPT the extra comma of the address line 2 field.

gsed 's/^\([^,]*,[^,]*,[^,]*\),\([^,]*,[^$]*$\)/\1\2/'
4,330
Posted By sitney
Here is another address snippet: JOSE ...
Here is another address snippet: JOSE TORRES 277 URB CRISTAL AGUADILLA PR006036348
MR ...
34,992
Posted By sitney
awk -F"|" '{print $1}' filename
awk -F"|" '{print $1}' filename
4,330
Posted By sitney
I want something that looks specifically at the...
I want something that looks specifically at the zip code position chars 149-157 because there will be addresses with 5 digit numbers in them that will match against a general grep statement. As in...
4,330
Posted By sitney
Matching a string (zip code) from a list in a separate file
I have a list of postal addresses and I need to pull the records that match a list of zip codes in a separate file. The postal addresses are fixed width. The zip code is located in character position...
1,531
Posted By sitney
Scottn - can you demonstrate how csplit would...
Scottn - can you demonstrate how csplit would work for the example given?

Franklin52 - That is a valid awk alternative, but it is not much more elegant than the sed method.

Thanks for the...
1,531
Posted By sitney
Splitting a file by arbitrary values
How do I split a file into unequal line number segments? For example, I have a 100,000 line file that I need to split into 4 or 5 segments and the segments are not uniform, so split will not work in...
2,031
Posted By sitney
That was very elegant! It actually gives a count...
That was very elegant! It actually gives a count for each state. I will try to parse the syntax so I can build such awk commands myself. Thanks.
2,031
Posted By sitney
Matching 2 chars of a string that repeat
Hello Unix gurus,

I have a gzipped file where each line contains 2 street addresses in the US. What I want to do is get a count for each state that does not match.

What I have so far is:
$...
Forum: What is on Your Mind? 11-16-2009
17,259
Posted By sitney
When I have a problem that I cannot resolve I...
When I have a problem that I cannot resolve I come to unix.com to see if I can find a solution from a previous posting. Many times I can. If my problem is relatively unique then I will post the...
8,088
Posted By sitney
Thanks Danmero. This works perfectly. If you...
Thanks Danmero. This works perfectly. If you could unpack this part of the Awk statement for my learning benfit, that would be extremely helpful and appreciated.

c=(NR%n)?c:0}
8,088
Posted By sitney
The problem with the split command is that it...
The problem with the split command is that it takes sequential rows from the target file. It does not pull every nth line from the file as requested. This won't work.
8,088
Posted By sitney
File splitter by nth row
I need to split a file into n separate files of about the same size. The way the file will be split is at every nth row, starting with the first row, that row will be cut and copied to it's...
2,232
Posted By sitney
If string matches within 2 files, delete one file.
I have a directory with a large # of files and in each file I am looking to match a string in one file with a string in the subsequent n file(s). If there is a match between a string in one file and...
Forum: OS X (Apple) 08-28-2009
6,746
Posted By sitney
or head -1 input*.txt | grep -v '==>' >...
or

head -1 input*.txt | grep -v '==>' > output.txt

The Mac OS X head command outputs "==>" along with filename, so just delete that line and you should be good to go.
Forum: OS X (Apple) 08-28-2009
8,714
Posted By sitney
Install Xcode then maports
As Holden said, first install Xcode then install macports. Also, when you do a macports selfupdate, you have to use sudo.

blake [ ~/scratch ]$ sudo port selfupdate
Password:

MacPorts base...
Forum: OS X (Apple) 08-28-2009
3,940
Posted By sitney
Mac OS X is unix
Under the hood, Mac OS X is unix. I recommend that you familiarize yourself with the Terminal application (found in Utilities) and get a feel for the command line.

I have not needed to install a...
6,954
Posted By sitney
I need the exact same solution to the same...
I need the exact same solution to the same problem. But I get an error when I run your script:

#!/bin/tcsh
set maildir=/my/maildir
foreach dupstring ("`grep -m 1 -h -R "^Message-ID:" $maildir/ |...
5,125
Posted By sitney
cat data.txt | rev
cat data.txt | rev
26,725
Posted By sitney
Your requirements don't specify whether you want...
Your requirements don't specify whether you want to sort by year first, but only by month. So this one liner should meet that requirement:

sort -t"," -k 3 -t"-" -k 2 -M birthdays.txt |awk -F","...
9,404
Posted By sitney
$names{"$first,$last"}{count}++; This is...
$names{"$first,$last"}{count}++;


This is indeed much simpler looking. I will take a stab at describing this line: This hash idiom associates each $first,$last element with it's count.


...
9,404
Posted By sitney
You said, I am crystal clear with this...
You said,

I am crystal clear with this clarification. Thanks.

However, the hash structure you used

$names{"$first,$last"}={count => ++$count{"$first,$last"},
name => "$first $mi $last...
9,404
Posted By sitney
KevinADC - I really appreciate your response...
KevinADC - I really appreciate your response here.

It works! When I run your perl script, I get these results:
$ cat newnames.txt
John A Smith NY
Adam J Clark PA

Despite my vague...
9,404
Posted By sitney
Extracting records with unique fields from a fixed width txt file
Greetings,

I would like to extract records from a fixed width text file that have unique field elements.

Data is structured like this:

John A Smith NY
Mary C Jones WA...
Showing results 1 to 24 of 24

 
All times are GMT -4. The time now is 08:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy