Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tfr

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 10 Jun 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc