05-19-2008
Sed and awk backslash characters
Hi,
I have a variable read from user input:
PROFILESROOTDIR="\\194.185.82.188\CMSRepository\EncodingProfiles"
awk -F"=" -v gr=$PROFILESROOTDIR '/ProfilesRootDirectoryFromXOEMachine/{$2=gr;}1' OFS="=" $CFGFILE > "${CFGFILE}_new"
For this awk to work properly I need to replace in the variable each \ character with \\\ using sed but I just can't manage to do that.
Thanks,
Bianca
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i have this script that searches for a pattern.
However it fails if the pattern includes some
special characters. So far, it fails with the
following strings:
1. -Cr
2. $Mj
3. H'412
would a sed or awk be more effective?
i don't want the users to put the (\)
during the search (they... (5 Replies)
Discussion started by: apalex
5 Replies
2. Shell Programming and Scripting
Hi,
I have the following example string:
today_is_a_good_day.txt
The character "_" inside the string can sometimes be more or less. The solution for every string equal the count of "_" should be alway the rest after the last underline character.
Result: day.txt
I want to use awk... (5 Replies)
Discussion started by: climber
5 Replies
3. Shell Programming and Scripting
Hello All,
I have been searching and trying this for a bit now. Can use some assistance.
Large 5000 line flat file.
bash, rhel5
Input File Sinppet:
Fri Oct 30 09:24:02 EDT 2009 -- 1030
Fri Oct 30 09:26:01 EDT 2009 -- 73
Fri Oct 30 09:28:01 EDT 2009 -- 1220
Fri Oct 30 09:30:01 EDT... (9 Replies)
Discussion started by: abacus
9 Replies
4. Shell Programming and Scripting
Hello everyone:
I have ran into this a few times now where my skills are just not up to snuff when it comes to Unix. So, I came here to find some beard stroking Unix wizard to help me.
Basically, I am using OS X 10.5 in large scale at work and sometimes I have to run some custom reports. ... (5 Replies)
Discussion started by: tlarkin
5 Replies
5. Shell Programming and Scripting
Hi All,
I have a requirement to read a line from a file with some search string, replace any backslash characters in that line and store in a variable.
Shell script: replace.ksh
#!/bin/bash
file2=input.rtf
line=`grep "Invoice Number" ${file2} | head -1 | sed 's/\\//g'`
echo "start... (6 Replies)
Discussion started by: prashas_d
6 Replies
6. Shell Programming and Scripting
I have a shell script that I have written to be a kind of to-do/notepad that's quickly executable from the command line. However, special characters tend to break it pretty well.
Ie: "notes -a This is an entry." works fine.
"notes -a This is (my) entry." will toss back a bash syntax error on... (5 Replies)
Discussion started by: skylersee
5 Replies
7. Shell Programming and Scripting
Input:
:: gstreamer
:: xine-lib
:: xine-lib-extras
Output should be:
gstreamer xine-lib xine-lib-extras
How can it be done with sed or perl? (12 Replies)
Discussion started by: cola
12 Replies
8. Shell Programming and Scripting
hyper link- abc:8081/xyz/2.5.6/rtyp-2.5.6.jar
Needs to get "rtyp-2.5.6.jar" i.e character after last backslash "/"
how to do this using sed/awk??
help is highly appreciated. (7 Replies)
Discussion started by: kkscm
7 Replies
9. Shell Programming and Scripting
Hi,
I have a string wherein i need to replace special characters with backslash and that character.
Ex:
If my string is a=qwerty123@!,
then the new string should be a_new=qwerty123\@\!\,
Thanks (3 Replies)
Discussion started by: temp_user
3 Replies
10. Shell Programming and Scripting
Is there a command for sed and awk that will only sort the line with more characters?
#cat file
123
12345
12
asdgjljhhho
bac
ss
Output:
asdgjljhhho
#cat file2
11.2
12345.00
21.222
12345678.10 (2 Replies)
Discussion started by: invinzin21
2 Replies
LEARN ABOUT DEBIAN
ir-keytable
IR-KEYTABLE(1) User Commands IR-KEYTABLE(1)
NAME
ir-keytable - a swiss-knife tool to handle Remote Controllers.
SYNOPSIS
ir-keytable [OPTION]... --device [/dev/input/event* device]
ir-keytable [OPTION]... --sysdev [ir class (f. ex. rc0)]
ir-keytable [OPTION]... [for using the rc0 sysdev]
DESCRIPTION
ir-keytable is a tool that lists the Remote Controller devices, allows one to get/set IR keycode/scancode tables, test events generated by
IR, and to adjust other Remote Controller options.
Note: You need to have read permissions on /dev/input for most of the options to work.
OPTIONS
-a, --auto-load=CFGFILE
Auto-load a table, based on a configuration file. Only works with sysdev.
-c, --clear
clears the old table
-d, --device=DEV
ir device to control
-D, --delay=DELAY
Sets the delay before repeating a keystroke
-k, --set-key=SCANKEY
Change scan/key pairs
-p, --protocol=PROTOCOL
Protocol to enable (the other ones will be disabled). To enable more than one, use the option more than one time
-P, --period=PERIOD
Sets the period to repeat a keystroke
-r, --read
reads the current scancode/keycode table
-s, --sysdev=SYSDEV
ir class device to control
-t, --test
test if IR is generating events
-v, --verbose
enables debug messages
-w, --write=TABLE
write (adds) the scancodes to the device scancode/keycode table from the specified TABLE file
-?, --help
Prints the help message
--usage
Give a short usage message
-V, --version
print the v4l2-utils version
Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. Options can be combined
together.
The options arguments are:
DEV the /dev/input/event* device to control
SYSDEV the ir class as found at /sys/class/rc
TABLE a file wit a set of scancode=keycode value pairs
SCANKEY
a set of scancode1=keycode1,scancode2=keycode2.. value pairs
PROTOCOL
protocol name (nec, rc-5, rc-6, other) to be enabled
DELAY Delay before repeating a keystroke
PERIOD Period to repeat a keystroke
CFGFILE
configuration file that associates a driver/table name with a keymap file
EXIT STATUS
On success, it returns 0. Otherwise, it will return the error code.
EXAMPLES
To list all connected Remote Controller devices:
ir-keytable
To clean the keycode table and use a newer one:
ir-keytable -c -w /etc/rc_keymaps/nec_terratec_cinergy_xs
To append more codes to the existing table:
ir-keytable -w /etc/rc_keymaps/nec_terratec_cinergy_xs
To read the current keytable, on the second remote controller: ir-keytable -s rc1 -r
BUGS
Report bugs to Mauro Carvalho Chehab <mchehab@redhat.com>
COPYRIGHT
Copyright (c) 2010-2011 by Mauro Carvalho Chehab <mchehab@redhat.com>.
License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
v4l-utils January 2011 IR-KEYTABLE(1)