Skip to main content

Removing duplicates with awk

To remove duplicates in linux you can use awk command as follows:

 awk -F- '!seen[$1]++' file.txt > output.txt

where:

-F is paraeter to deternime separator used to define columns and in ths case the dash 8-) is the sparator used

'!seen[$1]++' is the expression used for the line in order to be printed

> is the instruction to send command output o a file

Comments

Popular posts from this blog

Diferencias del Metodo equals() y ==

Por ejemplo, el tipo de datos int, en Java, es un tipo de dato de los llamados primitivos (más o menos como c++), con lo cuál puedes utilizar los operadores lógicos y aritméticos de la forma habitual. En tu caso puedes utilizar el operador == de la manera normal. Sin embargo, Integer, no es un tipo de dato primitivo. Es una clase!!. Entoces cuando tú tienes un objeto del tipo Integer NO estás manejando su valor, sino un puntero a tu objeto Integer. Porque en Java todo son punteros (menos los tipos de datos primitivos). Así que cuando utilizas el operador == no estás comparando el valor de los integer, sino los punteros (las direcciones que apuntan al objeto). De modo que para objetos estás obligado a utilizar el método equals().

Configuring web application with gwt+spring+hibernate

Building a web application using hibernate, spring and gwt. This time we will show how to create and cofigure an application that will use hibernate , spring and gwt. I will use HR sample database that comes with OracleXE. First , you have to create a GWT project (you can follow the steps for that on  https://developers.google.com/web-toolkit/ ) After you have the project created you need to create a tree of packages like that: Open HumanResources.gwt.xml and add the following line : By doing that you tell gwt to include model package and all dependent packages into gwt compilation Now we can start configuring spring and hibernate. to configure spring first you have to add the following lines on web.xml This will allow spring context to start doing its business. The you will have to create a field called "app-config.xml" in which you will define the settings for spring and hibernate. Over this app-config file first configure the properties as follo...