Skip to content

Commit 4ddb821

Browse files
committed
Added solution of problem 194
1 parent 52f985c commit 4ddb821

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/solutions/s0194_transpose_file.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
awk '
3+
{
4+
for (i = 1; i <= NF; i++) {
5+
if (NR == 1) {
6+
a[i] = $i
7+
} else {
8+
a[i] = a[i] " " $i
9+
}
10+
}
11+
}
12+
END {
13+
for (i = 1; i <= NF; i++) {
14+
print a[i]
15+
}
16+
}' file.txt

0 commit comments

Comments
 (0)