test.csv
1name,age
2Alice-Alice,30
3Bob,25
4Charlie,35
lower & lower_
lowercase the string and lower_
will lowercase the string in place.
1filterx csv test.csv -e -H --oH 'lower_(name)'
2
3### Output
4name,age
5alice-alice,30
6bob,25
7charlie,35
upper & upper_
same as lower
but for uppercase.
replace & replace_
replace will replace all occurrences of a substring with another substring, while replace_
will replace in place.
1filterx csv test.csv -e -H --oH 'replace(name, "Alice", "lady")'
2
3### Output
4name,age
5lady-lady,30
6Bob,25
7Charlie,35
replace_one & replace_one_
same as replace
but only replaces the first occurrence.
1filterx csv test.csv -e -H --oH 'replace_one(name, "Alice", "lady")'
2
3### Output
4name,age
5lady-Alice,30
6Bob,25
7Charlie,35
slice & slice_
get a slice of the string, slice
will return a new string while slice_
will modify the string in place.
slice
assumes 0-based indexing, so slice(name, 3)
will return string from 0 with length 3. slice(name, 3, 2)
will return string from 3 with length 2.
1filterx csv test.csv -e -H --oH 'slice(name, 3)'
2### Output
3name,age
4Ali,30
5Bob,25
6Cha,35
it also supports (start, length)
syntax.
1filterx csv test.csv -e -H --oH 'slice(name, 3, 2)'
2### Output
3name,age
4ce,30
5ob,25
6rl,35
strip & strip_
remove leading and trailing string, strip
will return a new string while strip_
will modify the string in place.
1filterx csv strip.csv -e -H --oH 'strip_(a, "ap")'
2
3### Output
4a
5pleple
6oommmoo
lstrip & lstrip_
same as strip
but only remove leading string.
rstrip & rstrip_
same as strip
but only remove trailing string.
len
returns the length of the string.
1filterx csv test.csv -e -H --oH 'alias(len) = len(name)'
2
3### Output
4name,age,len
5Alice-Alice,30,11
6Bob,25,3
7Charlie,35,7