|
|
在linux中,把csv文件转换成excel表格(xlsx或者xls)
6 [5 C% L5 h+ F% q9 }" ]' N
! U$ b( t7 F6 e" p! Z echo -e 'surname,name,age\nCarlo,Smith,23\nJohn,Doe,46\nJane,Doe,69\nSarah,Meyer,23\n' > example.csv
2 T* t2 ]! X5 ^, B2 `5 V! S
; n5 H8 B* K, V yum provides unix2dos
/ S2 m$ g: q* s- z/ M4 ]Loaded plugins: fastestmirror, langpacks
) G: F& ]; D. a2 h3 O, kRepodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
, V' e5 E/ q% z6 fLoading mirror speeds from cached hostfile
4 P3 B9 @4 X/ V4 t' Q/ D6 s2 ]dos2unix-6.0.3-7.el7.x86_64 : Text file format converters
n6 |# G1 b. X1 Q1 n3 h5 R7 VRepo : local
" b/ X: d- x% Q$ G% uMatched from:) o4 S/ z, `2 N9 C
Provides : unix2dos = 6.0.3-7.el7& y3 t2 g) b9 s, z% |4 x! Z
; q) \0 V1 A0 O: s5 o' A0 ~# ~yum install -y unix2dos
+ B4 G2 y3 [; z- oLoaded plugins: fastestmirror, langpacks
; O( u/ l* S! ^5 D& H( s4 r: SRepodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
i7 [; \+ Z- D( F4 A9 c8 fbase | 3.6 kB 00:00:00 " B6 |' w& y6 P, w# I. _0 m
Could not get metalink https://mirrors.fedoraproject.or ... =epel-7&arch=x86_64 error was
" ^! F4 I; c! F4 K5 y$ R3 e14: curl#35 - "Peer reports incompatible or unsupported protocol version."2 C% P! v& e2 b+ }" b
extras | 2.9 kB 00:00:00 7 K: L0 O: f8 ]- B' K* s/ L+ ^
updates | 2.9 kB 00:00:00
$ T- W4 t& y* c0 u7 Z+ e- ~! [+ X. ~updates/7/x86_64/primary_db | 20 MB 00:00:01
7 e8 [0 s! F: N7 yDetermining fastest mirrors
3 N$ z. `. Y) ]9 [* } * base: mirrors.bupt.edu.cn
! J# d2 ^5 C* @2 w * epel: mirrors.tuna.tsinghua.edu.cn4 L8 L0 ]" O3 f" Z
* extras: mirrors.bupt.edu.cn
$ Z' i' ^5 `6 j) l3 g3 n/ q. N * updates: mirrors.bupt.edu.cn
" R6 t1 [! D JResolving Dependencies+ P. v8 |' R% h3 N) ^
--> Running transaction check5 P: j4 n. }; }" P3 `
---> Package dos2unix.x86_64 0:6.0.3-7.el7 will be installed3 {% X2 i" D9 h9 j- t. \& Y- a' C
--> Finished Dependency Resolution4 g7 g3 f% J7 s. l
, ~! ~7 c+ _/ F' j, I; QDependencies Resolved6 W' ]; ]/ Q$ ]5 U3 {
8 y6 A5 ~" R" p/ K8 Q) v& g$ Z==============================================================================================================================================================================================" J7 y' a- _% }, [% ~5 y
Package Arch Version Repository Size
: V: x, |6 F) P==============================================================================================================================================================================================
" S2 f. w6 z2 _ H' r! AInstalling:- Z6 y; f6 L3 {3 r
dos2unix x86_64 6.0.3-7.el7 base 74 k2 {: ~+ Y& U* I0 Q; c( o
2 x. C& o5 J ^6 d4 R/ t1 NTransaction Summary
' r Z7 m8 Q* ?, K1 ^$ o2 k==============================================================================================================================================================================================
9 `' i" G3 J- D! Z' pInstall 1 Package
, y* n/ w# b6 S% ~9 l% S4 i) f* [( w- \; q$ D9 b! O
Total download size: 74 k
& A) |# {# [. w. tInstalled size: 190 k
: |. ?* c$ K) ] p) NDownloading packages:
# D* a$ F5 C3 edos2unix-6.0.3-7.el7.x86_64.rpm | 74 kB 00:00:00 $ I4 r9 ]) x/ _5 H) B3 p- C
Running transaction check
7 `5 `0 m+ I; BRunning transaction test! Z( B+ I! `3 o5 b4 p
Transaction test succeeded0 G. X; J _' y8 V
Running transaction2 W2 J6 j/ P* M; E$ T) p+ I1 A
Installing : dos2unix-6.0.3-7.el7.x86_64 1/1 ' R! n1 j4 k- l: R6 I7 j
Verifying : dos2unix-6.0.3-7.el7.x86_64 1/1 + F X" W5 b! \+ Z. R1 C
8 B% Y8 \, q2 \0 T1 L# L
Installed:
$ I# B0 {5 }( R dos2unix.x86_64 0:6.0.3-7.el7
5 Q0 V3 W c6 u7 y A3 o; `7 S4 E9 }1 t. E$ P) G
Complete!
& M F, l5 ?/ ?1 `) K' H% u3 U$ e' ~9 d5 N
' W p* O# i6 j2 H" e, N7 S/ @+ S$ _, v d2 L
unix2dos example.csv4 b# q' n. b2 f0 ?3 J f% H$ n4 P
unix2dos 2023-03-10xunjian.csv
- v3 f8 w) P9 N7 m! Yunix2dos: Binary symbol found at line 1
7 y; f a8 h, `# {* }unix2dos: Skipping binary file 2023-03-10xunjian.csv' N4 c* k& r/ V" M9 Y! Y% u1 R
5 J, J% C- y7 n; A' m. I. Z2 G6 Q2 |) g3 \1 K
' J+ b; M& z& W7 |' K* n# t
" J' s `2 } ~ssconvert example.csv example.xlsx% u6 |: E5 s7 d+ P; N+ h
3 S' @4 b* V ~! P
7 w2 }* ~" C/ c5 r" \+ c+ E ssconvert example.csv example.xls; H2 U) C3 q9 N: D. R9 p
4 X9 T6 S6 e u1 _# R
# I* m' G' q6 ~. g: g4 ` |
|