Tag Info

New answers tagged

0

If you can abide python, a simple script will display ASCII values of characters: Create a script (call it for example ascii.py) #!/usr/bin/python import fileinput for line in fileinput.input(): for c in line: print ord(c) then call the script thus: echo "hello" | ascii.py This could easily be modified to total ASCII values.


0

This comes down to the problem of iterating over the letters of a word, which is not trivial in bash. My approach is horribly hacky, but seems to work: #!/bin/bash WORD="$1" REGEXP=''; ASCIISUM=0 while true; do LETTER=$(echo "$WORD" | sed "s/$REGEXP\(.\).*/\1/") test "$LETTER" == "$WORD" && break; ASCII=$(printf '%d' ...


0

A grep solution: grep -m 1 -oP 'dbus[^ ]+\.el7' file -m 1 prints only one match, -o only the matching part and -P uses Perl regex. And a sed solution: sed -n 's/.*\(dbus.*\.el7\).*/\1/p' file | head -1 Removes all before and after dbus.*el7 and prints it (p), but only the first match (head -1).



Top 50 recent answers are included