| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
Hi,
Thanks, but this solution (without -i) show me the result and don't write/save the file.
This is a file exemple. the original file has many more rows and columns
"id";"lastname";"firstname";"adress";"zip";"town"
"9515";"CRAIG";"PAUL";"3 Av Marie Curie";"75001";"Paris"
"355";"BROSNAN";"MARIE ODILE";"43 Rue PASTEUR";"75001";"Paris"
"85";"CONNERY";"JEAN-CHARLES";"7 Rue LECOURBE";"14256";"Seville"
"5315125";"MOORE";"JEAN-MARC";"12 Av PASTEUR";"47852";"Rome"
in my example I would apply the results of sed (sed -i -r "s/(.*)/\L\1/; s/\<(.)/\u\1/g" ) only in column 3 (title firstname) .
"id";"lastname";"firstname";"adress";"ZIP";"TOWN"
"9515";"CRAIG";"Paul";"3 Av Marie Curie";"75001";"Paris"
"355";"BROSNAN";"Marie Odile";"43 Rue PASTEUR";"75001";"Paris"
"85";"CONNERY";"Jean-Charles";"7 Rue LECOURBE";"14256";"Seville"
"5315125";"MOORE";"Jean-Marc";"12 Av PASTEUR";"47852";"Rome"
Once obtained this result I could apply a sed command on the column of my choice.
And for now I just can't do it. :-(
-----Message d'origine-----
De : [email protected] [mailto:[email protected]]
Envoyé : jeudi 10 décembre 2015 17:35
À : [email protected]
Objet : Re: upper/lower case
On 10/12/15 17:04, MOKRANI Rachid [email protected] [sed-users] wrote:
> Many thanks for all your answer.
>
> Is it possible to pipe the awk result to a sed command ? (I read the
> man, looking on the net, but I find nothing)
>
> For exemple, my filename is : a.csv
> This file has 20 colums with ";" separator
>
> I need to apply the command below on to the colum 3. (colum of my
> choice)
>
> Something like that , but it does not work.
>
> sed -i -r "s/(.*)/\L\1/; s/\<(.)/\u\1/g" | awk -F";" '{print $3}'
> a.csv
awk -F";" '{print $3}' a.csv | sed -r "s/(.*)/\L\1/; s/\<(.)/\u\1/g"
sed -i is infile mode. Can't be used with after pipe (and not before, of
course)
>
>
> regards.
>
>
>
> -----Message d'origine-----
> De : [email protected] [mailto:[email protected]]
> Envoyé : mercredi 9 décembre 2015 20:11 À : [email protected]
> Objet : Re: upper/lower case
>
> If helpful, here is Thierry's solution #1, for one column (the data you sent), the sed script just formatted a little differently.
>
> $ cat input.txt
> PAUL
> JEAN-CHARLES
> MARIE ODILE
>
> $ sed -r "s/(.*)/\L\1/; s/\<(.)/\u\1/g" input.txt Paul Jean-Charles
> Marie Odile
>
> For the case with multiple columns, if Thierry's solution #2 does not work, you might send an input file and desired output.
>
> Daniel
>
> On 12/9/2015 2:33 AM, MOKRANI Rachid [email protected]
> [sed-users]
> wrote:
>> Hi,
>>
>> I own a file with multiple columns, and in one column there are names which are all in uppercase.
>>
>> Example :
>> PAUL
>> JEAN-CHARLES
>> MARIE ODILE
>> ...
>> ....
>>
>> I would like to get a result like.
>> Paul
>> Jean-Charles
>> Marie Odile
>>
>> How to do that very simply with sed/awk easy to get this result?
>>
>>
>> Many thanks for your suggestion.
>> Regards.
>> __________________________
>> Avant d'imprimer, pensez à l'environnement ! Please consider the environment before printing !
>> Ce message et toutes ses pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. IFP Energies nouvelles décline toute responsabilité au titre de ce message. This message and any attachments are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. IFP Energies nouvelles should not be liable for this message.
>> __________________________
>>
>>
>> ------------------------------------
>> Posted by: MOKRANI Rachid <[email protected]>
>> ------------------------------------
>>
>
> ------------------------------------
> Posted by: Daniel Goldman <[email protected]>
> ------------------------------------
>
------------------------------------
Posted by: Thierry Blanc <[email protected]>
------------------------------------
--
------------------------------------
Yahoo Groups Links
__________________________
Avant d'imprimer, pensez à l'environnement ! Please consider the environment before printing !
Ce message et toutes ses pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. IFP Energies nouvelles décline toute responsabilité au titre de ce message. This message and any attachments are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. IFP Energies nouvelles should not be liable for this message.
__________________________