05-13-2005
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
In a previous post I needed to walk through a list of files. This works fine, but when I attempt to use the nawk line (below) I can only write to first file that's found. The files I'm trying to write to (${target_dir}${product}.html) already exist and are created by another part of my script that... (1 Reply)
Discussion started by: ricksj
1 Replies
2. Shell Programming and Scripting
Hi friends ,
I am confused with << EOF
EOF
Most of the cases I found
sqlplus $db_conn_str << EOF
some sql staments
EOF
another exapmle is
#!/bin/sh
echo -n 'what is the value? '
read value
sed 's/XXX/'$value'/' <<EOF
The value is XXX
EOF (1 Reply)
Discussion started by: imipsita.rath
1 Replies
3. Shell Programming and Scripting
Hi Everyone,
1.txt
test here (888_f)a/fff (eeee) test2 (q)--(qq)
the output is
test here a/fff test2 --
means remove the characters in between (), and () itself. Please advice.
Thanks (3 Replies)
Discussion started by: jimmy_y
3 Replies
4. Shell Programming and Scripting
Hi,
I want to know how I can remove the last characters of ANY pdf file. I read it under "od" in the command shell to see which were the last characters:
$od corruptedfile.pdf -c
When I see the file, I need to keep only the last characters, or "end of the file": %EOF (obviously keeping all... (1 Reply)
Discussion started by: diegugawa
1 Replies
5. Shell Programming and Scripting
fq-bar-something-1.0-r1.src.rpm ----> fq-bar-something
fq-bar-xx-r1-rel.src.rpm ---------> fq-bar-xx
fq-bar-ff-ver-11-rel.src.rpm -------> fq-bar-ff-ver
any help? (5 Replies)
Discussion started by: yanglei_fage
5 Replies
6. Shell Programming and Scripting
I am trying to get grep with awk command into variable.
But facing error.
Could someone pls help.
$ cat test_file
DEPLOYMENT="abc" # com
cluster="bcn"
$ grep DEPLOYMENT test_file | awk -F "\"" '{ print $2 }'
abc
$ a=`echo "grep DEPLOYMENT test_file | awk -F \"\\\"\" '{ print $2 }'"` ;... (6 Replies)
Discussion started by: Manasa Pradeep
6 Replies
7. Shell Programming and Scripting
I have the following code for removing duplicate records based on fields in inputfile file & moves the duplicate records in duplicates file(1st Awk) & in 2nd awk i fetch the non duplicate entries in inputfile to tmp file and use move to update the original file.
Requirement:
Can both the awk... (4 Replies)
Discussion started by: siramitsharma
4 Replies
8. Shell Programming and Scripting
Hi All,
I have searched many threads for possible close solution. But I was unable to get simlar scenario.
I would like to print all duplicate based on 3rd column except the first occurance. Also would like to print if it is single entry(non-duplicate).
i/P file
12 NIL ABD LON
11 NIL ABC... (6 Replies)
Discussion started by: sybadm
6 Replies
9. Shell Programming and Scripting
cat input.txt
a x
b y
c z
Expected output
x
y
z (11 Replies)
Discussion started by: cola
11 Replies
10. UNIX for Beginners Questions & Answers
Hi Everybody:
I need your help, please...
I have this file *.txt
0000 | 16010201 22000000 67892000 00000000 00000000 00000100 72246681 28E08236
| ~~~~"~~~g~ ~~~~~~~~~~~~~r$f~(~~6 |
0020 | 10476173 90010100 10000000 00000001 05000226 17163011 12442212 48140484
|... (2 Replies)
Discussion started by: solaris21
2 Replies
gets(n) Tcl Built-In Commands gets(n)
__________________________________________________________________________________________________________________________________________________
NAME
gets - Read a line from a channel
SYNOPSIS
gets channelId ?varName?
_________________________________________________________________
DESCRIPTION
This command reads the next line from channelId, returns everything in the line up to (but not including) the end-of-line character(s), and
discards the end-of-line character(s).
ChannelId must be an identifier for an open channel such as the Tcl standard input channel (stdin), the return value from an invocation of
open or socket, or the result of a channel creation command provided by a Tcl extension. The channel must have been opened for input.
If varName is omitted the line is returned as the result of the command. If varName is specified then the line is placed in the variable
by that name and the return value is a count of the number of characters returned.
If end of file occurs while scanning for an end of line, the command returns whatever input is available up to the end of file. If chan-
nelId is in nonblocking mode and there is not a full line of input available, the command returns an empty string and does not consume any
input. If varName is specified and an empty string is returned in varName because of end-of-file or because of insufficient data in non-
blocking mode, then the return count is -1. Note that if varName is not specified then the end-of-file and no-full-line-available cases
can produce the same results as if there were an input line consisting only of the end-of-line character(s). The eof and fblocked commands
can be used to distinguish these three cases.
EXAMPLE
This example reads a file one line at a time and prints it out with the current line number attached to the start of each line.
set chan [open "some.file.txt"]
set lineNumber 0
while {[gets $chan line] >= 0} {
puts "[incr lineNumber]: $line"
}
close $chan
SEE ALSO
file(n), eof(n), fblocked(n), Tcl_StandardChannels(3)
KEYWORDS
blocking, channel, end of file, end of line, line, nonblocking, read
Tcl 7.5 gets(n)