0

I have a file that looks like this

100:Marley:Crossan:803-555-2920:mcrossan0@simplemachines.org:71971:Hazelcrest:Columbia:29220:Ohio
101:Fidel:Branni:316-555-3295:fbranni1@themeforest.net:6:Prentice:Wichita:67205:Kansas
102:Dew:Aprahamian:952-555-3540:daprahamian2@howstuffworks.com:71:Northview:Monticello:55564:Minnesota
103:Isak:Fibben:816-555-3944:ifibben3@time.com:8:Lerdahl:Miami:64193:Florida
104:Arleta:Carden:608-555-0235:acarden4@utexas.edu:6:Mandrake:Madison:53790:Wisconsin

[This is fake personal info]

and I need to separate each information between ":" inside an xlsx file

I've tried to play around with it, but the farthest I got was this:

for x in $(grep "" $1 | cut -d: -f1 | cut -d: -f1)
do
    echo -e "$x \\t" >> tests/infosEmployes.xlsx
done
wjandrea
  • 28,235
  • 9
  • 60
  • 81
  • Could you replace all the colons with commas and then save it as a CSV file? I think you can even rename a CSV file changing the extension to xlsx and it will open in Excel. – Matt Korostoff Dec 13 '21 at 02:08
  • No, sadly I can't, my assignment is to use the txt file as provided, I can't change anything in it – PancakeRabbit Dec 13 '21 at 02:16
  • There might be tools that can automate this better. For example, check out this question on Unix & Linux: [convert CSV to XLS file on linux](https://unix.stackexchange.com/q/158254/117037). `unoconv` looked promising, but I couldn't get it to work. – wjandrea Dec 13 '21 at 02:28

0 Answers0