• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Find duplicate numbers and replace
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find duplicate numbers and replace


  • Subject: Re: Find duplicate numbers and replace
  • From: Skeeve <email@hidden>
  • Date: Wed, 14 May 2008 22:45:44 +0200

Mark J. Reed schrieb:
If you just add /g to your s//, it shouldn't matter what the line
endings are... The example file had all the matching numbers at the
beginning of a line, but that doesn't affect the logic of the solution
if you do a global search.
Not quite. If we want to make sure it's a line start we have to anchor using ^. But then we'll have to add "m" to the "g" and still won't get every platform. If you let this run:
perl -e '
my %eols= (
CR_OLD_MAC => "\015",
LF_UNIX => "\012",
CRLF_DOS => "\015\012",
LFCR_OBSCURE => "\012\015",
);
while (my($n,$eol)=each %eols) {
print $n,"\n";
$_= join($eol,1..6); print join("\n",/^(\d+)/gm),"\n\n";
}
'


You'll quickly see what I mean:

LFCR_OBSCURE
1

CR_OLD_MAC
1

LF_UNIX
1
2
3
4
5
6

CRLF_DOS
1
2
3
4
5
6

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Find duplicate numbers and replace
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Re: Re1: Mail scripting : How to select… continuation... (From: Philip Aker <email@hidden>)
 >Find duplicate numbers and replace (From: "Script2" <email@hidden>)
 >Re: Find duplicate numbers and replace (From: "Mark J. Reed" <email@hidden>)
 >Re: Find duplicate numbers and replace (From: "Mark J. Reed" <email@hidden>)
 >Re: Find duplicate numbers and replace (From: "Mark J. Reed" <email@hidden>)
 >Re: Find duplicate numbers and replace (From: "Mark J. Reed" <email@hidden>)
 >Re: Find duplicate numbers and replace (From: Skeeve <email@hidden>)
 >Re: Find duplicate numbers and replace (From: "Mark J. Reed" <email@hidden>)
 >Re: Find duplicate numbers and replace (From: Skeeve <email@hidden>)
 >Re: Find duplicate numbers and replace (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Find duplicate numbers and replace
  • Next by Date: Re: Image Disk Size
  • Previous by thread: Re: Find duplicate numbers and replace
  • Next by thread: Re: Find duplicate numbers and replace
  • Index(es):
    • Date
    • Thread