Socket
Socket
Sign inDemoInstall

tfr

Package Overview
Dependencies
46
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tfr

Searches for a pattern in a file line by line and outputs a replacement string that can contain any captured groups.


Version published
Weekly downloads
2
decreased by-75%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Text Transformer

Searches for a pattern in a file line by line and outputs a replacement string that can contain any captured groups.

Install

npm install --global tfr

Examples

# prints out all the lines that look like URLs as links
tfr '^(https?://.*)' -r '<a href="$1">$1</a>' example.txt

# find all the files that have a parent directory called lib
find . | tfr '\/lib\/' -r '$_'

# print how many 500 errors are in the access logs per hour
cat access.log | trf '^(.*?T\d+).* 500 ' | sort | uniq -c

Usage

tfr <pattern> [files..]

Search and replace strings in a file e.g. tfr '(.*?) (.*?)' test.txt. By default
matching groups will be printed out separated by tabs

Positionals:
pattern  The pattern to match e.g. ^(.*)$                             [string]
files    The files to search                                          [string]

Options:
--version          Show version number                               [boolean]
--help             Show help                                         [boolean]
--replacement, -r  The replacement text that can use replacement variables for
                    matched groups i.e. $1 $2 etc.                     [string]
--delimiter, -d    The output delimiter, defaults to a tab
                                                        [string] [default: "  "]

Keywords

FAQs

Last updated on 10 Jun 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc