Código [Seleccionar]
egrep -v "Fecha de presentaci|Liq[.] N|Ventas? en|Ventas? Tj" archivo.txt > nuevo_archivo.txt
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menúegrep -v "Fecha de presentaci|Liq[.] N|Ventas? en|Ventas? Tj" archivo.txt > nuevo_archivo.txt
#!/usr/bin/env perl
use v5.18; # garantizamos un buen soporte de Unicode
use utf8::all; # activamos todo el soporte para UTF-8
use re '/xiu'; # las exp. reg. tendrán por defecto estas opciones
my @tests =
( 'kill the noise - all in my head feat. awolnation (batou mix)'
, 'artist - track name feat. Mister 漢字仮--名交じり文 [usa remix]'
, 'kill th-e noise - all in my head (feat awolnation)'
, 'Dj E-nergy C-21 - My Super-hero track! featuring Dj Ass-hole (usa remix)'
, 'Dj E-nergy C-21 - My Super-hero track! (feat Dj Ass-hole)'
, 'Dj E-nergy C-21 - My Super-hero track! feat Dj Ass-hole'
, 'Dj E-nergy C-21 - My Super-hero track!'
, 'Carbin & Sirmark - Sorry Feat. Sevener'
, 'Flight Facilities - Heart Attack Feat. Owl Eyes (Snakehips Remix)'
, 'Flight Facilities - Heart Attack Feat. Owl Eyes [Snake--hips Remix]'
, 'Fedde Le Grand - Cinematic'
, 'Fedde Le Grand Feat. Denny White - Cinematic'
, 'Artist-Name - Track Name feat someone'
, 'Artist Name - Track-Name feat someone'
);
my $del1 = qr/[([]/;
my $del2 = qr/[])]/;
my $featuring = qr/
(?<d1>$del1)?
(?<featuring>feat(?:uring|[.]|) \s .+?)
(?(<d1>)$del2)
/;
my $artista = qr/(?<artista>.+?)/;
my $resto = qr/
(?<cancion>.+?) \s*
(?:$featuring)? \s*
(?<extra>$del1 .+? $del2)?
/;
my $titulo = qr/^ $artista \s+ - \s+ $resto \s* $/;
for my $test (@tests) {
$test =~ /$titulo/;
say $test;
print $+{'artista'};
for my $text (qw(featuring - cancion extra)) {
if ($text eq '-') {
print " -";
}
elsif ($+{$text}) {
print " " . $+{$text};
}
}
print "\n";
# say join " ", @+{qw(artista featuring)}, '-', @+{qw(cancion extra)};
say '-' x 30;
}
say $titulo;
kill the noise - all in my head feat. awolnation (batou mix)
kill the noise feat. awolnation - all in my head (batou mix)
------------------------------
artist - track name feat. Mister 漢字仮--名交じり文 [usa remix]
artist feat. Mister 漢字仮--名交じり文 - track name [usa remix]
------------------------------
kill th-e noise - all in my head (feat awolnation)
kill th-e noise feat awolnation - all in my head
------------------------------
Dj E-nergy C-21 - My Super-hero track! featuring Dj Ass-hole (usa remix)
Dj E-nergy C-21 featuring Dj Ass-hole - My Super-hero track! (usa remix)
------------------------------
Dj E-nergy C-21 - My Super-hero track! (feat Dj Ass-hole)
Dj E-nergy C-21 feat Dj Ass-hole - My Super-hero track!
------------------------------
Dj E-nergy C-21 - My Super-hero track! feat Dj Ass-hole
Dj E-nergy C-21 feat Dj Ass-hole - My Super-hero track!
------------------------------
Dj E-nergy C-21 - My Super-hero track!
Dj E-nergy C-21 - My Super-hero track!
------------------------------
Carbin & Sirmark - Sorry Feat. Sevener
Carbin & Sirmark Feat. Sevener - Sorry
------------------------------
Flight Facilities - Heart Attack Feat. Owl Eyes (Snakehips Remix)
Flight Facilities Feat. Owl Eyes - Heart Attack (Snakehips Remix)
------------------------------
Flight Facilities - Heart Attack Feat. Owl Eyes [Snake--hips Remix]
Flight Facilities Feat. Owl Eyes - Heart Attack [Snake--hips Remix]
------------------------------
Fedde Le Grand - Cinematic
Fedde Le Grand - Cinematic
------------------------------
Fedde Le Grand Feat. Denny White - Cinematic
Fedde Le Grand Feat. Denny White - Cinematic
------------------------------
Artist-Name - Track Name feat someone
Artist-Name feat someone - Track Name
------------------------------
Artist Name - Track-Name feat someone
Artist Name feat someone - Track-Name
------------------------------
(?^uix:^ (?^uix:(?<artista>.+?)) \s+ - \s+ (?^uix:
(?<cancion>.+?) \s*
(?:(?^uix:
(?<d1>(?^uix:[([]))?
(?<featuring>feat(?:uring|[.]|) \s .+?)
(?(<d1>)(?^uix:[])]))
))? \s*
(?<extra>(?^uix:[([]) .+? (?^uix:[])]))?
) \s* $)
#!/usr/bin/python
import time, sys, subprocess,os
while True:
time.sleep(1) # esperamos un poco
comando = "ps -eo pid,cmd | fgrep konsole | fgrep -v fgrep | awk {'print $1;'}"
proceso = subprocess.Popen(comando , shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
next_line = proceso.stdout.readline()
if next_line != '':
comando = "kill -9 " + next_line;
proceso = subprocess.Popen(comando , shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE)
#!/usr/bin/env perl
do {
if ($terminal = qx(/bin/ps -eo pid,cmd | fgrep konsole | fgrep -v fgrep | awk '{print \$1}')) {
chomp $terminal;
system('kill', '-9', $terminal);
}
sleep 1;
} while ("forever");
Cita de: Eleкtro en 28 Septiembre 2015, 13:20 PMEDITO: ¡Ah, claro, ya lo entiendo! Se busca un guión separado por espacios " - ", por eso sabes cuando partir, pero entonces eso no me sirve ya que el nombre del artista o el nombre de la canción también pueden contener un guión con espacios.Sí, pero en los ejemplos mostrados no hay ningún nombre de artista que tenga un guión con espacios, así que se supone que esa es el "ancla" que podemos usar para hacer la partición. Y como se parte por la primera aparición de esa estructura, no importa que aparezca después en el nombre de la canción.