function::stringat - Linux


stringat is a versatile command-line utility for manipulating strings in Linux. It allows users to extract, modify, and compare strings with precision, making it essential for text processing tasks.


stringat [options] <string> <expression>

Required arguments:

  • string: The input string to be manipulated.
  • expression: A string manipulation expression.


  • -r, –regex: Use regular expressions in the expression.
  • -i, –ignore-case: Ignore case during comparisons and searches.
  • -m, –match: Return the first match of the expression in the string.
  • -n, –no-match: Return the string if the expression does not match.
  • -s, –split: Split the string based on the expression and return an array of substrings.
  • -j, –join: Join multiple strings together using the expression as a separator.
  • -v, –version: Display version information.


Extract a substring:

stringat "Hello World" --extract "llo Wo"

Replace a substring:

stringat "This is a string" --replace "is" "was"

Check if a substring exists:

stringat "My name is John" --match "John"

Split a string into words:

stringat "This is a sentence" --split " "

Join strings with a delimiter:

stringat "one" "two" "three" --join ":"

Common Issues

  • Incorrect syntax: Ensure the syntax is correct and all required arguments are provided.
  • Invalid expression: Verify that the expression is valid and follows the correct syntax.
  • Unicode support: stringat may have limitations in handling Unicode characters in some cases.


stringat can be integrated with other Linux commands using pipelines:

echo "Hello World" | stringat --extract "llo Wo" | grep "llo"

Related Commands

  • sed: A stream editor for text processing.
  • awk: A pattern-matching language for text processing.
  • grep: A tool for searching for patterns in text.