Skip to main content
Rollback to Revision 6
Source Link
Kamil Maciorowski
  • 24.5k
  • 2
  • 69
  • 129

Delete the question Bash: title-case a csv field

DELETE the question,not actualI have this input file on a CentOS system:

1,,,,ivan petrov,,67, 2,2,,,Vasia pupkin,director,8, 3,,,,john Lenon,,, 

The task is to change it to:

1,,,,Ivan Petrov,,67, 2,2,,,Vasia Pupkin,director,8, 3,,,,John Lenon,,, 

Name and Surname should start with upper letter

#!/bin/bash while IFS="," read line do ns=$(echo $line | awk -F, '{print $5}') name=$(echo $ns | awk '{print $1}') surname=$(echo $ns | awk '{print $2}') ns=$(echo ${name^} ${surname^}) awk -v nm="$ns" 'BEGIN{FS=OFS=","}{$5=nm}1' accnew.csv done < <(tail -n +2 accnew.csv) > 1new.csv 

That's my script, thanks for answersbut it doesn't work correctly.

Delete the question

DELETE the question,not actual, thanks for answers

Bash: title-case a csv field

I have this input file on a CentOS system:

1,,,,ivan petrov,,67, 2,2,,,Vasia pupkin,director,8, 3,,,,john Lenon,,, 

The task is to change it to:

1,,,,Ivan Petrov,,67, 2,2,,,Vasia Pupkin,director,8, 3,,,,John Lenon,,, 

Name and Surname should start with upper letter

#!/bin/bash while IFS="," read line do ns=$(echo $line | awk -F, '{print $5}') name=$(echo $ns | awk '{print $1}') surname=$(echo $ns | awk '{print $2}') ns=$(echo ${name^} ${surname^}) awk -v nm="$ns" 'BEGIN{FS=OFS=","}{$5=nm}1' accnew.csv done < <(tail -n +2 accnew.csv) > 1new.csv 

That's my script, but it doesn't work correctly.

deleted 401 characters in body
Source Link

Bash: title-case a csv field Delete the question

I have this input file on a CentOS system:

1,,,,ivan petrov,,67, 2,2,,,Vasia pupkin,director,8, 3,,,,john Lenon,,, 

The task is to change it to:

1,,,,Ivan Petrov,,67, 2,2,,,Vasia Pupkin,director,8, 3,,,,John Lenon,,, 

Name and Surname should start with upper letter

#!/bin/bash while IFS="," read line do ns=$(echo $line | awk -F, '{print $5}') name=$(echo $ns | awk '{print $1}') surname=$(echo $ns | awk '{print $2}') ns=$(echo ${name^} ${surname^}) awk -v nm="$ns" 'BEGIN{FS=OFS=","}{$5=nm}1' accnew.csv done < <(tail -n +2 accnew.csv) > 1new.csv 

That's my scriptDELETE the question, but it doesn't work correctly.not actual, thanks for answers

Bash: title-case a csv field

I have this input file on a CentOS system:

1,,,,ivan petrov,,67, 2,2,,,Vasia pupkin,director,8, 3,,,,john Lenon,,, 

The task is to change it to:

1,,,,Ivan Petrov,,67, 2,2,,,Vasia Pupkin,director,8, 3,,,,John Lenon,,, 

Name and Surname should start with upper letter

#!/bin/bash while IFS="," read line do ns=$(echo $line | awk -F, '{print $5}') name=$(echo $ns | awk '{print $1}') surname=$(echo $ns | awk '{print $2}') ns=$(echo ${name^} ${surname^}) awk -v nm="$ns" 'BEGIN{FS=OFS=","}{$5=nm}1' accnew.csv done < <(tail -n +2 accnew.csv) > 1new.csv 

That's my script, but it doesn't work correctly.

Delete the question

DELETE the question,not actual, thanks for answers

edited tags; edited title
Link
Stéphane Chazelas
  • 586.2k
  • 96
  • 1.1k
  • 1.7k

Bash: changingtitle-case a csv columnfield

deleted 2 characters in body
Source Link
Loading
added minor detail, reformatting
Source Link
terdon
  • 252.7k
  • 69
  • 481
  • 719
Loading
added 244 characters in body
Source Link
Loading
Source Link
Loading