找回密码
 注册
查看: 410|回复: 0

linux系统中把csv文件转换成excel表格

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-3-10 15:38:22 | 显示全部楼层 |阅读模式
在linux中,把csv文件转换成excel表格(xlsx或者xls)) q$ d( l- d. P5 A5 t) @, W5 N
2 o" D0 i! D6 c+ K4 ~7 s9 |3 s0 \
echo -e 'surname,name,age\nCarlo,Smith,23\nJohn,Doe,46\nJane,Doe,69\nSarah,Meyer,23\n' > example.csv
" O: R. A- [  ~  }; ?5 i( F! R( F( @, l4 `3 S, n9 |0 H) W+ x$ {
yum provides unix2dos
6 q* Z$ Z, U, d) ~( e- \% [Loaded plugins: fastestmirror, langpacks8 k. |0 C: i/ f0 o
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast* m: C$ W2 L  q* w
Loading mirror speeds from cached hostfile
4 G9 j8 u* S( q6 F2 qdos2unix-6.0.3-7.el7.x86_64 : Text file format converters
% \7 }, A3 M, iRepo        : local
* D$ _8 o/ N$ |Matched from:
7 Z5 @3 ~0 `% f5 _& _/ ?/ aProvides    : unix2dos = 6.0.3-7.el74 a0 i! P" V8 j0 Z; G4 F6 r3 J2 O
$ i8 F% ~0 o' k3 z
yum install -y unix2dos5 F  c  U* L2 p  O( J2 |7 w8 N! R
Loaded plugins: fastestmirror, langpacks
, @, Y" w% n' \! j* o( b& zRepodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
( X0 d  U6 I% x6 mbase                                                                                                                                                                   | 3.6 kB  00:00:00     / d5 O7 R$ x7 ^; B
Could not get metalink https://mirrors.fedoraproject.or ... =epel-7&arch=x86_64 error was( r* ^* L; r, K
14: curl#35 - "Peer reports incompatible or unsupported protocol version."; m/ c8 K/ D. v" [( V
extras                                                                                                                                                                 | 2.9 kB  00:00:00     2 K: D5 N- b. W; H3 j
updates                                                                                                                                                                | 2.9 kB  00:00:00     
& [; e1 [  ~9 F+ Kupdates/7/x86_64/primary_db                                                                                                                                            |  20 MB  00:00:01     
) m9 a. \/ v. }; RDetermining fastest mirrors" \, w. R8 e  t  P: Q: W
* base: mirrors.bupt.edu.cn2 S& z1 o& ^  ~. {& l+ x" b
* epel: mirrors.tuna.tsinghua.edu.cn% i5 b! t8 X8 y
* extras: mirrors.bupt.edu.cn# f) d0 S" |- G
* updates: mirrors.bupt.edu.cn* ~, [; R* c% Q$ S1 w, h
Resolving Dependencies
* ?2 B) g4 s$ K--> Running transaction check
$ G5 q8 \# W5 w- h# P; w: Z---> Package dos2unix.x86_64 0:6.0.3-7.el7 will be installed
- j( W) z$ ]. v2 z+ h" }--> Finished Dependency Resolution& b5 }! ?8 B2 V3 t6 E: P
4 n5 g6 T( J0 K' X- ^
Dependencies Resolved. v' m9 q/ E2 l. |! L
4 h+ {$ G+ \9 s0 b1 o
==============================================================================================================================================================================================# W5 B3 ]( f, Q2 Q4 _: K
Package                                       Arch                                        Version                                            Repository                                 Size
! \* b, N! E! t1 f: d2 h==============================================================================================================================================================================================
9 n- M4 h6 w3 K/ ^& {% }/ R$ ^Installing:
! ^6 ^6 y9 q7 b% z# Y8 Z: {& B dos2unix                                      x86_64                                      6.0.3-7.el7                                        base                                       74 k5 i' |) z  }3 w$ D! h& R# d
3 Y+ J% k4 k0 L0 a% I
Transaction Summary1 i* ]: \4 O  K0 Q$ O, V3 e
==============================================================================================================================================================================================4 g, Q$ j. v+ g1 g1 M9 c
Install  1 Package
& b3 U7 ~( T- D3 W7 q" Y* z& m
+ v% b2 p7 k' TTotal download size: 74 k9 ]' h- {. _: M3 p5 y! z
Installed size: 190 k8 w& N* J& {4 o  E8 a* a
Downloading packages:
3 P  `' R5 x1 v* N5 ]1 Fdos2unix-6.0.3-7.el7.x86_64.rpm                                                                                                                                        |  74 kB  00:00:00     + L6 E2 Y/ L  \$ c, h* A
Running transaction check
4 J" U7 v; U0 D# q2 tRunning transaction test. Z6 v4 K& i! u+ |
Transaction test succeeded
& R' B4 A! ^' GRunning transaction
- `* f/ w: n8 O0 u+ Y5 M  Installing : dos2unix-6.0.3-7.el7.x86_64                                                                                                                                                1/1
& r, E0 U. x* {# I! X- h  Verifying  : dos2unix-6.0.3-7.el7.x86_64                                                                                                                                                1/1
* D9 f5 d+ S  |8 w8 w  L$ B; P
Installed:
8 |6 O( Z# J8 U! z2 z* v/ j  dos2unix.x86_64 0:6.0.3-7.el7                                                                                                                                                               
7 b" @: N' f- K  \3 L- |
* l* R! T8 V/ h  z# l" Q" l& aComplete!
/ C5 B  @! Z; @+ `1 T
0 {1 a, H2 o/ p" f. l( Z2 a. w4 t; A' c6 M  u5 D
% r: O: E+ k2 J0 [
unix2dos example.csv& X5 c( M$ I) x% C
unix2dos 2023-03-10xunjian.csv$ T1 ~$ z! d. E, E
unix2dos: Binary symbol found at line 18 ]% O9 s. h4 v/ K
unix2dos: Skipping binary file 2023-03-10xunjian.csv
7 y/ r* ]! h1 C% g! A( T: r- J- B
6 w1 B, ]8 H- s& Q
! i- s  R8 E  I% w* Q& G- `, g! v8 E3 E3 c% `

8 ~9 c0 M8 {7 J+ ~ssconvert example.csv example.xlsx, a# _" M8 d! }% Y" |" Q

! Y2 Q  Y0 ~( M6 ?: G, _  H
9 N0 p9 L- \8 n# y1 o6 n3 ]5 z ssconvert example.csv example.xls
  v% |( f/ k$ j3 @, Z0 W( r. E4 r- c7 F. a4 L( E8 b( K
* w7 R* E1 Z8 i! Q
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:43 , Processed in 0.024834 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表