Skip to content

ekarlsn/flo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flo

A compact CLI tool for text transformations, making complex operations intuitive.

Status

Very much a work in progress. Expect frequent changes and breaking changes. Expected unexpected behavior.

Install

git clone https://github.com/yourusername/flo.git
cd flo && roc build

Usage

cat input.txt | flo [options -] action1 arg1 - action2 arg2 ...

Options: --help, --debug

Why flo?

Flo simplifies complex text transformations that would otherwise require multiple commands:

Example 1: Extract and process the second column from CSV

Without flo:

cat data.csv | cut -d',' -f2 | sed 's/^ *//' | sed 's/ *$//' | sort | uniq

With flo:

cat data.csv | flo split "," - keep-cols 1 - trim - sort - uniq

Example 2: Extract error logs with timestamps

Without flo:

grep "ERROR" logs.txt | sed 's/^.*\[//' | sed 's/\].*$//' | sort

With flo:

cat logs.txt | flo grep "ERROR" - strip-left "[" - strip-right "]" - sort

Example 3: Format a list of items

Without flo:

cat items.txt | sort | uniq | sed 's/^/- /'

With flo:

cat items.txt | flo sort - uniq - col-prepend "- "

Actions

  • keep-rows N or start:end: Keep specific rows
  • keep-cols N or start:end: Keep specific columns
  • dup: Duplicate each line
  • trim: Remove whitespace from line ends
  • strip-left/right str: Remove specified string from start/end
  • col-append/prepend str: Add text to end/start of each line
  • sort: Sort lines alphabetically
  • uniq: Remove consecutive duplicates
  • split delimiter: Split lines on delimiter
  • grep pattern: Filter lines containing pattern

Debug Mode

See transformation steps:

echo "a,b,c" | flo --debug split "," - trim
echo "   a,b,c" | flo --debug - split "," - trim

Output:

Input:
   a,b,c


Then: (Split ","):
   a
b
c


Then: Trim:
a
b
c

About

Shell script pipeline in one command

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages