You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-3Lines changed: 32 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# FsShell
2
2
List of Shell-like commands for use in F#.
3
3
4
+
I commonly work with data files in the legal space, so wanted a set of commands that I could use for quicker data manipulation and investigation.
5
+
4
6
## Caveat
5
7
These commands are NOT intended for projects with a long life. It is recommended that this only be used in the FSI or for short fire-and-forget utilities. As I eat my own dog food and become more proficient in idiomatic F#, some things might change.
6
8
@@ -13,6 +15,8 @@ man "";;
13
15
14
16
[All functions are in FsShell.fs](src/FsShell/FsShell.fs)
15
17
18
+
Note: Most functions work with `seq<string>`. Functions prefixed with an 'x' work with `seq<string[]>`
19
+
16
20
```
17
21
System
18
22
cd Change directory
@@ -21,7 +25,7 @@ System
21
25
mv Move file
22
26
cp Copy file
23
27
ls List
24
-
ll List with details (fullname * size * FileInfo)
28
+
ll List with details
25
29
find Find files
26
30
find_p Find folders
27
31
Output
@@ -33,12 +37,18 @@ Output
33
37
tee_a Append to a file and passthrough
34
38
cat Read a list of files consecutively
35
39
Data Manipulation
36
-
NOTE: these will create seq<string list> that aren't friendly with other commands
37
40
cut Split lines at tabs
38
41
cut_d Split lines at delimeter
39
42
cut_c Cut character range options
40
43
cut_c2 Cut character ranges
41
-
cutx Splits data file into columns
44
+
cut_x Splits data file into columns
45
+
xjoin Join columns into data
46
+
sort Sorting
47
+
sort_k Sorting by a substring
48
+
sort_kn Sorting by a substring as a number
49
+
xsort Sorting by columns
50
+
xsort_n Sorting by columns, each as a number
51
+
xsort2 Sorting by columns, specify as string or number
42
52
Data Flow
43
53
grep Filter lines to include
44
54
grep_i Filter lines to include, case insensitive
@@ -48,6 +58,14 @@ Data Flow
48
58
grep_in Filter lines to exclude, case insensitive
49
59
egrep_n Filter lines to exclude with regex
50
60
egrep_in Filter lines to exclude with regex, case insensitive
61
+
xgrep Filter on a pattern in specified columns
62
+
xgrep_i Filter on a case-insensitive pattern in specified columns
63
+
xgrep_n Inverted filter on a pattern in specified columns
64
+
xgrep_in Inverted filter on a case-insensitive pattern in specified columns
65
+
xegrep Filter on a regex in specified columns
66
+
xegrep_i Filter on a case-insensitive regex in specified columns
67
+
xegrep_n Inverted filter on a regex in specified columns
68
+
xegrep_in Inverted filter on a case-insensitive regex in specified columns
51
69
head_n First count lines
52
70
head First 10 lines
53
71
tail_n Last count lines, or skip first count of lines
@@ -118,6 +136,17 @@ val it: seq<string array> =
118
136
[|"Val 1-3"; "Val 2-3"; "Val 3-3"|]]
119
137
```
120
138
139
+
### Data Investigation
140
+
```F#
141
+
> // Used this command to find duplicate values
142
+
- cat [ "file.dat" ]
143
+
- |> cutx // parse the file
144
+
- |> Seq.map (fun cols -> cols[0]) // get data from the first column
0 commit comments