Home >

escape characters

  • What's the maximum length for a multibyte escape sequence?October 5

    ESC sends \x1b. That's 1 byte: the actual escape character. Page Up sends \x1b[H. That's 3 bytes. F2 sends \x1b[OQ. That's 4 bytes. F5 sends \x1b[15~. That's 5 bytes. What's the maximum length for one of these? Is this documented somewhere?

  • awk FS with back slashesOctober 5

    I use the command find . -maxdepth 1 -not -type d which generates output like ./filename.1.out I pipe the find command output to awk. The goal is to split on either the literal ./ or .. I have it working using: find . -maxdepth 1 -not -type d | gawk

  • Script SSH Interactive Console that needs escaped charsFebruary 13

    I would like to modify my existing SSH connection via a shell script. So if I run an existing script remotely I would like it to open a new port to be tunnelled. Interactively I can do this via: [email protected]:~$ ~C ssh> -R 9000:localhost:9000 A

  • Double quotes issue in bash scriptFebruary 1

    I have a shell script I am trying to get working. I need the output to be a certain way and I know I'm just not escaping the characters correctly. script: #!/bin/bash set -x DATE=$(date +%Y-%m-%d-%M) ELEMENTS="ele1,ele2,ele3" TOPIC="dogs ca

  • Is it possible to do a here-document in one line or echo verbatim?January 20

    I often find myself testing out a command (e.g. cat file | awk 'stuff') in the shell and when I'm satisfied with the way it works, I append the command to a script file. Let's say this is the command I created cat file.txt | awk -F '|' '$3 == "\"

  • Escaping "=" (equal sign) in for /fJanuary 15

    I'm trying to run the following command in a "FOR /F" in Windows' shell... wmic process where ParentProcessId=%%PID%% get ProcessId The = between ParentProcessId and %PID% keeps gettings replace by a space. The result being: for /F "useback

  • Maximizing tmux session shows weird ANSI SequencesJanuary 14

    I have a tmux session inside Putty. It was fine for past many months, but now I see a strange thing. When I maximize a normal Putty window, and if cursor is not on a new line, then I get some weird ANSI Sequences in the shell. Eg, I maximized 4 times

  • sed to match pattern between matching curly bracesJanuary 11

    From a pattern such as [string 1]{string 2} I want to extract string 2, the string between the last pair of matching curly braces -- that is delete [string 1] and the open { and close }. My attempt below breaks when there is a additional [, ] pairs i

  • How to interpret ' character in a string passed through SSHJanuary 4

    New to BASH and Linux and need some quick help. I have written a quick bash script that asks the user for a username and password from the command line and passes that info to a remote server later via SSH. Problem is, one user has a ' character in t

  • How do I find directories with a question mark in the name? Escaping not working?January 3

    I am try to find directories like services-client?.git using the command find . -name *\?.git but get all directories ending in .git What I'm doing is downloading a file from amazon s3 and in creating directory based on the lines in the file. I gener

  • Issue with column command and color escape codesDecember 27

    I'm colorizing the header of a table formatted with column -ts $'\t' Works well without color codes, but when I add color codes to the first line column doesn't properly align the output. Without colored output it works as expected: printf "1\t2\t3\n

  • Escaping ampersand (&) in Windows batch script used to map/connect network drivesDecember 17

    Using a simple batch file to connect to network drives on Windows start-up but one of the folder names contains an ampersand and I cannot for the life of me, figure out how to escape it. Here is the command:- net use P: \\SERVER\Path\Applications & S

  • How to prevent random console output from breaking the terminal?

    How to prevent random console output from breaking the terminal?December 7

    There are many questions on SE that show how to recover from terminal broken by cat /dev/urandom. For those that are unfamiliar with this issue - here what it is about: You execute cat /dev/urandom or equivalent (for example, cat binary_file.dat). Ga

  • Escape characters from echo -eNovember 30

    I have the following in my .bashrc file I use for a log: function log(){ RED="\e[0;31m" RESET="\e[0m" echo -e "${RED}$(date)" "${RESET}$*" >> "$HOME"/mylog.txt } But when I do something with an apost

  • Escape special chars in csh aliasNovember 18

    I want to create an alias for the following thing: diff -r <dir1> <dir2>| grep diff | grep -v "Files " | grep -v "\.git" \ | awk '{print "tkdiff " $3 " " $4}' I am getting lost with the special chars, ca

  • How to escape metacharacters for egrep like metaquote from Perl?November 12

    Perl has a function called metaquote() to escape all special characters for a regular expression. Is there an equivalent technique for egrep? Example: If I am searching for the string abc.def.ghi, I need to remember to escape the dots manually, e.g.,

  • How do I escape a dot / period in bash string matchNovember 3

    This is my first post, and I am really appreciating all the answers which helped me so far on that website, I hope this is not a redundant post, but I couldn't find something similar here. I try to split a String which I'll retrieve from a file into

  • Why does "shift-tab" result in "Escape" in the terminal?October 24

    I just noticed this by accident. I use the vi readline mode (run set -o vi in bash) so it is particularly noticeable; in emacs readline mode I don't think Esc does anything, but in vi mode it exits insert mode (enters normal mode). I don't see Shift-

  • Shell-independent escaping for strings in scriptsOctober 21

    I just struggled (again) over this: # only in bash NORM=$'\033[0m' NORM=$'\e[0m' # only in dash NORM='\033[0m' # only in bash and busybox NORM=$(echo -en '\033[0m') The goal is to include special characters in the string, not only for output using ec

  • Executing a 'perl command' from shell and executing the same command from perl script using system commandOctober 21

    I am not able to take care of special characters. I have the following perl script. while(@mapping_array[$i]) { chomp(@mapping_array[$i]); my @core= split ( / / , $mapping_array[$i]) ; @core[0] =~ tr/ //ds ; ## Deleting blank spaces @core[1] =~ tr/ /

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.578 s.