Skip to content
IT Nursery
  • Home
  • Programming
    • Mac / IOS
    • Android
    • Web Applications
    • PHP
    • Java
    • C
    • C++
  • DataBase
    • MySQL
  • CMS
    • WordPress
  • System and Network
    • Serverfault

string

Why does the regex in bash works only if it is a variable and not directly? [duplicate]

by IT Nursery

Why does the regex in bash works only if it is a variable and not directly? [duplicate]

Tags bash, regular-expression, shell-script, string

Splitting bash command line argument

by IT Nursery

I think the simplest solution is just to use bash builtins: #!/bin/bash hostlist=${1//:/ } # this will replace all : with a space … Read more

Tags bash, shell-script, string

How to check if variable contains valid UTF-8 string without any control characters?

by IT Nursery

How to check if variable contains valid UTF-8 string without any control characters?

Tags bash, string

extract every nth character from a string

by IT Nursery

Using perl: $ echo 100000011100 | perl -nle ‘ for ($i = 0; $i < length()/2; $i++) { print substr($_,$i,1), substr($_,$i+6,1); } ‘ … Read more

Tags shell, shell-script, string

Bash brace expansion to remove part of filename

by IT Nursery

As addition to the John1024 answer (can’t commenting). Tried this method and found shortcut: Type full file name, which needed cut, using autocompletion … Read more

Tags bash, brace-expansion, string, syntax

Utility to get binary representation from string?

by IT Nursery

You can also do this (and many other things) using figlet with the binary font. $ echo foo | figlet -f binary 01100110 … Read more

Tags conversion, string

bash – True if the length of string is (non)zero? [duplicate]

by IT Nursery

The command [ -z $OUT ] is exactly equivalent to test -z $OUT which, if $OUT is empty, is the same as test … Read more

Tags shell-script, string, test, variable

Bash: value too great for base when using a date as array key

by IT Nursery

I can’t reproduce the problem with associative arrays: #! /bin/bash declare -A dailyData today=2021-02-08 todayData=whatever dailyData[“$today”]=”$todayData” But, if I use normal arrays, i.e. … Read more

Tags associative-array, bash, string

Using vim to delete all lines except those that match an arbitrary set of strings

by IT Nursery

The :global command that you reference in your question actually doesn’t just take literal strings, it handles any regular expression. So, you just … Read more

Tags regex, search, string, vim

Check if a shell variable has more than one line using built-ins?

by IT Nursery

There are several options (bash first, POSIX is below). The code inside each function could be easily used outside. #!/bin/bash nl=$’\n’ aregex (){ … Read more

Tags bash, posix, shell-script, string
Post navigation
Older posts
Page1 Page2 … Page96 Next →

Recent Posts

  • Advice for improving internal dashboard [closed]
  • grep : ‘+’ special character
  • File location for Syslogs in Centos machine
  • How to collect users’ task completion times?
  • “service {FOO} start” vs. “/etc/init.d/{FOO} start”? [closed]
IT Nursery
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Important Link

  • About
  • Privacy Policy
  • Contact

IT Nursery

The Goal of ITNursery Engaging the world to foster innovation through aggregate information. Our Question Answer post, blog information, products and tools help developers and technologists in life and at work.

copyright © 2023 All Right Reserved | IT NurSery