回答編集履歴

3

余計なコードを削除

2019/11/21 11:32

投稿

Umeeeh
Umeeeh

スコア1455

test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
 
20
20
 
21
- $ perl -nle 'print join ",", grep {!$buf{$_}++} split ",",$_; %buf=();' file.csv
21
+ $ perl -nle 'print join ",", grep {!$buf{$_}++} split ",",$_;' file.csv
22
22
 
23
23
  kingyo,panda,pig
24
24
 

2

「cat file.csv」を追加

2019/11/21 11:32

投稿

Umeeeh
Umeeeh

スコア1455

test CHANGED
@@ -4,7 +4,21 @@
4
4
 
5
5
  ```shell
6
6
 
7
+ $ cat file.csv
8
+
9
+ kingyo,panda,pig,pig
10
+
11
+ neko,inu,sakana,penguin
12
+
13
+ sea,see,sea,mountain
14
+
15
+ taro,taro,taro1,taro2
16
+
17
+ kanji,hiragana,katakana,eigo,kanji
18
+
19
+
20
+
7
- $ perl -nle 'print join ",", grep {!$seen{$_}++} split ",",$_; %seen=();' file.csv
21
+ $ perl -nle 'print join ",", grep {!$buf{$_}++} split ",",$_; %buf=();' file.csv
8
22
 
9
23
  kingyo,panda,pig
10
24
 

1

-a は冗長だったので修正。

2019/11/21 11:30

投稿

Umeeeh
Umeeeh

スコア1455

test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ```shell
6
6
 
7
- $ perl -anle 'print join ",", grep {!$seen{$_}++} split ",",$F[0]; %seen=();' file.csv
7
+ $ perl -nle 'print join ",", grep {!$seen{$_}++} split ",",$_; %seen=();' file.csv
8
8
 
9
9
  kingyo,panda,pig
10
10