Enviado em 28/07/2022 - 16:13h
sed "$(wc -l file.txt | cut -d ' ' -f 1)s/,$//" file.txt
sed "$(wc -l < file.txt)s/,$//" file.txt
Enviado em 28/07/2022 - 16:28h
sed "$(wc -l file.txt | cut -d ' ' -f 1)s/,$//" file.txt
wc -l < file.txt 500
Enviado em 28/07/2022 - 19:08h
sed "$(wc -l file.txt | cut -d ' ' -f 1)s/,$//" file.txt
wc -l < file.txt 500
Enviado em 28/07/2022 - 19:26h
#!/usr/bin/env bash file="linhas.txt" sed -i '$s/,$//' $file while read line; do printf "\x27%s\x27,\n" $line done < $file
$ sed -i '$s/,$//' linhas.txt
Enviado em 28/07/2022 - 19:38h
var=$(<arquivo.txt) echo "${var%?}" >arquivo.txt
Enviado em 28/07/2022 - 22:02h
sed "$(wc -l file.txt | cut -d ' ' -f 1)s/,$//" file.txt
wc -l < file.txt 500
Enviado em 29/07/2022 - 07:31h
#!/usr/bin/env bash file="linhas.txt" sed -i '$s/,$//' $file while read line; do printf "\x27%s\x27,\n" $line done < $file
$ sed -i '$s/,$//' linhas.txt
Enviado em 29/07/2022 - 09:57h
#!/usr/bin/env python3 def dos2unix(f): content = '' with open(f, "rb") as dos_file: content = dos_file.read() content = content.replace(b'\r\n', b'\n') with open(f, "wb") as unix_file: unix_file.write(content) input_file = "linhas.txt" # NOME DO ARQUIVO dos2unix(input_file) values = [] file = open(input_file, "r") for line in file: formatted_string = line.replace('\n', '')[:-1] values.append(formatted_string) # Exibe os valores na tela formatted_values = ",\n".join(values) print(formatted_values) # Exibe a Query de consulta #formatted_values = ",".join(values) #print(f"SELECT * FROM `table` WHERE `field` IN ({formatted_values})")
$ cat linhas.txt '5571996167892', '5583982093160', '5511910382315', '5511999353921', '5571996264463',
$ ./script.py '5571996167892', '5583982093160', '5511910382315', '5511999353921', '5571996264463'
$ ./script.py SELECT * FROM `table` WHERE `field` IN ('5571996167892','5583982093160','5511910382315','5511999353921','5571996264463')
Enviado em 29/07/2022 - 10:10h
#!/usr/bin/env python3 def dos2unix(f): content = '' with open(f, "rb") as dos_file: content = dos_file.read() content = content.replace(b'\r\n', b'\n') with open(f, "wb") as unix_file: unix_file.write(content) input_file = "linhas.txt" # NOME DO ARQUIVO dos2unix(input_file) values = [] file = open(input_file, "r") for line in file: formatted_string = line.replace('\n', '')[:-1] values.append(formatted_string) # Exibe os valores na tela formatted_values = ",\n".join(values) print(formatted_values) # Exibe a Query de consulta #formatted_values = ",".join(values) #print(f"SELECT * FROM `table` WHERE `field` IN ({formatted_values})")
$ cat linhas.txt '5571996167892', '5583982093160', '5511910382315', '5511999353921', '5571996264463',
$ ./script.py '5571996167892', '5583982093160', '5511910382315', '5511999353921', '5571996264463'
$ ./script.py SELECT * FROM `table` WHERE `field` IN ('5571996167892','5583982093160','5511910382315','5511999353921','5571996264463')
Enviado em 01/08/2022 - 07:21h
#!/usr/bin/env python3 def dos2unix(f): content = '' with open(f, "rb") as dos_file: content = dos_file.read() content = content.replace(b'\r\n', b'\n') with open(f, "wb") as unix_file: unix_file.write(content) input_file = "linhas.txt" # NOME DO ARQUIVO dos2unix(input_file) values = [] file = open(input_file, "r") for line in file: formatted_string = line.replace('\n', '')[:-1] values.append(formatted_string) # Exibe os valores na tela formatted_values = ",\n".join(values) print(formatted_values) # Exibe a Query de consulta #formatted_values = ",".join(values) #print(f"SELECT * FROM `table` WHERE `field` IN ({formatted_values})")
$ cat linhas.txt '5571996167892', '5583982093160', '5511910382315', '5511999353921', '5571996264463',
$ ./script.py '5571996167892', '5583982093160', '5511910382315', '5511999353921', '5571996264463'
$ ./script.py SELECT * FROM `table` WHERE `field` IN ('5571996167892','5583982093160','5511910382315','5511999353921','5571996264463')
Como aprovar Pull Requests em seu repositório Github via linha de comando
Como gerar um podcast a partir de um livro em PDF
Automatizando digitação de códigos 2FA no browser
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Organizando seus PDF com o Zotero
Erro no realm join [Resolvido]
Um programa para baixar vídeos: Parabolic
Como Definir o Painel Principal em Múltiplos Monitores no Linux Mint
tentando instalar em um notebook antigo o Linux LegacyOS_2023... (7)
BlueMail não abre no Kubuntu 25.04 (1)
Driver de rede realtek 8821ce bugado (8)
Atalhos duplicados (sobras de instalações anteriores) [RESOLVIDO] (5)