sexta-feira, 28 de junho de 2019

Unix Command - How to rename much files in directory to fixing filename?

Using shellscript with awk to change filename.

Wrong filename.: 0400000000192062019.zip
Wanted filename: 04000000001920062019.zip

First, create a mask to list files:


>$ ls -1 ????????????2062019.zip ????????????2062019.zip.fin

0400000000192062019.zip


0400000000192062019.zip.fin

Second, create a loop to work with filenames:


>$ for x in $(ls -1 ????????????2062019.zip ????????????2062019.zip.fin); do echo $x; done
0400000000192062019.zip

0400000000192062019.zip.fin

And next, using AWK to fix filename:

Testing

>$ for x in $(ls -1 ????????????2062019.zip ????????????2062019.zip.fin ); do new=$(awk 'BEGIN{file=ARGV[1]; print substr(file,1,14) "0" substr(file,15)}' $x); echo "changing filename $x to $new"; done

changing filename 0400000000192062019.zip to 04000000001920062019.zip
changing filename 0400000000192062019.zip.fin to 04000000001920062019.zip.fin


Fixing
>$ for x in $(ls -1 ????????????2062019.zip ????????????2062019.zip.fin ); do new=$(awk 'BEGIN{file=ARGV[1]; print substr(file,1,14) "0" substr(file,15)}' $x); echo "changing filename $x to $new"; mv $x $new; done

changing filename 0400000000192062019.zip to 04000000001920062019.zip
changing filename 0400000000192062019.zip.fin to 04000000001920062019.zip.fin


sexta-feira, 23 de setembro de 2016

Travel - Embu das Artes - SP

Cidade com artesanato, muito gostoso para se passear. Vale a visita!
City with manual art, very good to visiting!

Sugestão para almoçar:
To lunch:

Restaurante Buenos Aires com pratos argentinos:
Buenos Aires restaurant with Argentine food:

Rua da Matriz, 62 - Centro Histórico - Embubdas Artres - SP
Reservas: Neire Siqueira

Opção para duas pessoas muito bem servida, comendo 3 pessoas facilmente.
Option for 2 people but 3 eat well.

Maminha com arroz do chefe, purê de mandioquinha e salada
Sirloin tri tip roast with chief rice, mashed mandioquinha and salad.

Fantástico!!
Fantastic!!

Dono muito simpático, nos ofereceu até uma cortesia!
The owner was very nice and gave to us a gift!

Recomendo!
Recommend!

terça-feira, 29 de setembro de 2015

Config iOS9 for limited data package

If you have a limited data package, my suggestion is turn off Wi-Fi Assist.

1. In Settings, click into Cellular:

2. Scroll down to the bottom of Cellular page to turn off Wi-Fi Assist:

sábado, 22 de agosto de 2015

Dev - Eclipse - Pyton - Appengine - Installing on Mac


1. Download and install Eclipse Standard
    Download: Eclipse Mars 4.5 Standard

1.1 Installing Eclipse
    Install: in terminal, go to where you downloaded the eclise file


gzip -dv eclipse-standard-*.tar.gz

tar -xvf eclipse-standard-*.tar
cd eclipse

With Finder, go to eclipse directory and drag and drop the file eclipse into Dock


To run, click in eclipse icon

=========================================================

2. To install PyDev
From Help menu, choose Install New Software
Click Add and input the Repository:
Name: PyDev
Location: http://pydev.org/updates

Accept any license agreements and restart eclipse.


=========================================================

3. Install AppEngine
Donwload from: https://cloud.google.com/appengine/downloads

=========================================================

4. Install Google Plugin for Eclipse
From Help menu, choose Install New Software
Click Add and input the Repository:
Name: Google
Location: https://developers.google.com/eclipse/docs/install-eclipse-4.4

Select: Google Plugin for Eclipse (required)
            SDKs

Configure Path in Project > Properties > Resources > PyDev - PYTHONPATH > String Substitution Variables
GOOGLE_APP_ENGINE = /usr/local/google_appengine


https://cloud.google.com/appengine/docs/java/webtoolsplatform

=========================================================

have fun =)

terça-feira, 16 de dezembro de 2014

MacOS - how to accentuate the words

Well, when you want to accentuate and not have a special keyboard, you need to use this short keys:

For letter with ^ = option + i and letter
For letter with ~ = option + n and letter
For letter with ' = option + e and letter
For letter with ` = option + ` and letter
For letter ç = option + c

But if you want to do different, go to System Preferences/Language and then select Text/Input sources, after check the box for US International PC. If you don't use multiple keyboard, delete the others keyboard from list and clear the box for Show Input Menu in Menu Bar.  


Voalá, you ready to use! :))


terça-feira, 26 de agosto de 2014

Unix - how you can split a file to n-files?

You could use split command in unix:

split -l[max line number per file] file [prefix]

The default will create PREFIXaa, PREFIXab, ..

If you whan to exchange the lengh of suffixes, use -a [numer]. Will create PREFIXaaaa, PREFIXaaab,... If -a 4.
 

Example to split readme.txt that have 1000 lines into 10 files with name new_000 at new_009

split -l 100 -d 2 readme.txt new_


The man page:

       Output  fixed-size  pieces of INPUT to PREFIXaa, PREFIXab, ...; default
       size is 1000 lines, and default PREFIX is 'x'.  With no INPUT, or  when
       INPUT is -, read standard input.

       Mandatory  arguments  to	 long  options are mandatory for short options
       too. 
 -a, --suffix-length=N
	      use suffixes of length N (default 2) 
 -b, --bytes=SIZE
	      put SIZE bytes per output file 
 -C, --line-bytes=SIZE
	      put at most SIZE bytes of lines per output file 
 -d, --numeric-suffixes
	      use numeric suffixes instead of alphabetic 
-l, --lines=NUMBER
	      put NUMBER lines per output file 
 --verbose
	      print a diagnostic to standard error  just  before  each	output
	      file is opened 
 --help display this help and exit 
 --version
	      output version information and exit 
SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg. 

quinta-feira, 8 de maio de 2014

VIM: using accent in portuguese

How you can see and use accent in VIM for portuguese language?
Como ver e usar acentuação no VIM para língua portuguesa?

Have two way to do this in *Unix.

1. In Bash profile (~/.bashrc), set the environment variable LANG to latin1 or one of this below:

  • latin1
  • pt_BR.UTF-8
  • iso-8859-1
  • utf-8


2. In VIM profile (~/.vimrc)

  • set encoding=latin1
  • set fileencodings=latin1
  • set termencoding=latin1
  • set nocompatible


You can test in terminal to see if it is ok:

in bash:
    export LANG=latin1
    vim
    write something with accent (e.g. Português)

in vim:
    :set encoding=latin1
    write something with accent (e.g. Português)