12-07-2017
I repeat: Is this a homework assignment?
And, for the third time: Why is sed the only option for this task?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have an input below. If the term in the 1st column is equal, print the last row which 1st column is equal.In the below example, it's " 0001 k= 27 " and " 0004 k= 6 " (depicted in bold). Those terms in 1st column which are not repetitive are to be printed as well. Can any body help me... (9 Replies)
Discussion started by: Raynon
9 Replies
2. Shell Programming and Scripting
Hi, I am totally new to shell scripting.
I have a String "c:\working\html\index.txt.12-12-2009.bkp" I want to check if the string has more than one "." character. If it does I would like to retrieve only "c:\working\html\index.txt" i.e, discard the second occurrence of "." and the rest of the... (7 Replies)
Discussion started by: imr
7 Replies
3. Shell Programming and Scripting
Hi all,
I have a lot of files with extension ".o" and I would like to extract the 10th line after (last) occurrence of a given string in each of the files.
I tried:
$ grep "string_to_look_for" *.o -A 10 | tail -1
but it gives the occurrence in the last file with extension .o
... (1 Reply)
Discussion started by: f_o_555
1 Replies
4. Shell Programming and Scripting
Lets say I have file.txt:
(Product:Price:QuantityAvailable) (: as delimiter)
Chocolate:5:5
Banana:33:3
I am doing a edit/update function.
I want to change the Quantity Available, so I tried using the SED command to replace 5, but my Price which is also 5 is changed instead.
(for the Banana... (13 Replies)
Discussion started by: andylbh
13 Replies
5. Shell Programming and Scripting
Hi, i have file f1.txt with data like:
CHECK
a
b
CHECK
c
d
CHECK
e
f
JOB_START
....
I want to match the last occurrence of 'CHECK' until the end of the file.
I can use awk:
awk '/^CHECK/ { buf = "" } { buf = buf "\n" $0 } END { print buf }' f1.txt | tail +2Is there a cleaner way of... (2 Replies)
Discussion started by: ysrini
2 Replies
6. UNIX for Dummies Questions & Answers
hey guys, i have been trying to work this thing out with sed with no luck :confused:
i m looking for a way to replace only the first occurrence after a match
for example :
Cat
Realized what you gotta do
Dog
Realized what you gotta do
Sheep
Realized what you gotta do
Wolf
Realized... (6 Replies)
Discussion started by: boaz733
6 Replies
7. Shell Programming and Scripting
echo 'String#1 and String#2' | egrep -o -m 1 'String#.{1}'
String#1
String#2
I'm trying to just match the first occurrence of 'String#' + 1 character. I thought the "-m 1" switch would do that for me. Instead I get both occurrences. Can somebody provide some insight?
Thanks! (5 Replies)
Discussion started by: sudo
5 Replies
8. Shell Programming and Scripting
I need help with extract/print lines till stop pattern. This needs to happen after every 3rd occurrence of start pattern and continue till end of file. Consider below is an example of the log file. my start pattern will be every 3rd occurrence of ERROR_FILE_NOT_FOUND and stop pattern will be... (5 Replies)
Discussion started by: NSS
5 Replies
9. UNIX for Dummies Questions & Answers
Hi all,
I have an input file as below. I would like to count the occurrence of pattern matching 8th field for each line.
Input:
field_01 field_02 field_03 field_04 field_05 field_06 field_07 field_08
TA T TA T TA TA TA... (3 Replies)
Discussion started by: huiyee1
3 Replies
10. Shell Programming and Scripting
AWK command to get file content until 3 occurrence of pattern match,
INPUT FILE:
JMS_BODY_FIELD:JMSText = <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<custOptIn xmlns="http://com/walm/ta/cu/ccs/xml2">
<person>Romi</person>
<appName>SAP</appName>
</custOptIn>
... (4 Replies)
Discussion started by: prince1987
4 Replies
LEARN ABOUT LINUX
kbdrate
KBDRATE(8) Linux Programmer's Manual KBDRATE(8)
NAME
kbdrate - reset the keyboard repeat rate and delay time
SYNOPSIS
kbdrate [ -s ] [ -r rate ] [ -d delay ]
DESCRIPTION
kbdrate is used to change the keyboard repeat rate and delay time. The delay is the amount of time that a key must be depressed before it
will start to repeat.
Using kbdrate without any options will reset the repeat rate to 10.9 characters per second (cps) and the delay to 250 milliseconds (ms) for
Intel- and M68K-based systems. These are the IBM defaults. On SPARC-based systems it will reset the repeat rate to 5 cps and the delay to
200 ms.
OPTIONS
-s Silent. No messages are printed.
-r rate
Change the keyboard repeat rate to rate cps. For Intel-based systems, the allowable range is from 2.0 to 30.0 cps. Only certain,
specific values are possible, and the program will select the nearest possible value to the one specified. The possible values are
given, in characters per second, as follows: 2.0, 2.1, 2.3, 2.5, 2.7, 3.0, 3.3, 3.7, 4.0, 4.3, 4.6, 5.0, 5.5, 6.0, 6.7, 7.5, 8.0,
8.6, 9.2, 10.0, 10.9, 12.0, 13.3, 15.0, 16.0, 17.1, 18.5, 20.0, 21.8, 24.0, 26.7, 30.0. For SPARC-based systems, the allowable
range is from 0 (no repeat) to 50 cps.
-d delay
Change the delay to delay milliseconds. For Intel-based systems, the allowable range is from 250 to 1000 ms, in 250 ms steps. For
SPARC systems, possible values are between 10 ms and 1440 ms, in 10 ms steps.
-V Display a version number and exit.
BUGS
Not all keyboards support all rates.
Not all keyboards have the rates mapped in the same way.
Setting the repeat rate on the Gateway AnyKey keyboard does not work. If someone with a Gateway figures out how to program the keyboard,
please send mail to util-linux@math.uio.no.
All this is very architecture dependent. Nowadays kbdrate first tries the KDKBDREP and KIOCSRATE ioctls. (The former usually works on an
m68k machine, the latter for SPARC.) When these ioctls fail an ioport interface as on i386 is assumed.
FILES
/etc/rc.local
/dev/port
Linux 1.1.19 22 June 1994 KBDRATE(8)