07-08-2015
It creates the requested output file name for the redirection from two constants and the 3 chars (2,3,4) from your data line.
This User Gave Thanks to RudiC For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guys...
I'm working on #!/bin/sh script in a Solaris 7 box that should send several files over to another machine via FTP. Here's what the script looks like:
# This script will send the daily MSP customer counts
# to the Crystal Reports server located at 192.168.2.106
cd... (2 Replies)
Discussion started by: cdunavent
2 Replies
2. Shell Programming and Scripting
Hi everyone!!
I have a database table, which has file_name as one of its fields.
Example:
File_ID File_Name Directory Size
0001 UNO_1232 /apps/opt 234
0002 UNO_1234 /apps/opt 788
0003 UNO_1235 /apps/opt 897
0004 UNO_1236 /apps/opt 568
I have to... (3 Replies)
Discussion started by: ss3944
3 Replies
3. Shell Programming and Scripting
Files xxxxxxx.txt
------------------------------------------------------------------------------------------------------------------------------------
Req.By: xxxxxxx WABUSH MINES -
xxxxxx MINE (1001) Page: 1
Run on: 12/14/09... (4 Replies)
Discussion started by: sctxms
4 Replies
4. Shell Programming and Scripting
Guys I am having a problem with being able to find missing monitors in a configuration check script I am trying to create for accountability purposes for managing a large number of systems. What I am trying to do is run a script that will look at the raw config data in a file and pull all the pool... (7 Replies)
Discussion started by: scottzx7rr
7 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I'd like to process multiple files. For example:
file1.txt
file2.txt
file3.txt
Each file contains several lines of data. I want to extract a piece of data and output it to a new file.
file1.txt ----> newfile1.txt
file2.txt ----> newfile2.txt
file3.txt ----> newfile3.txt
Here is... (3 Replies)
Discussion started by: Liverpaul09
3 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I will use below command for grep single string ("osuser" is search string)
ex: find . -type f | xarg grep -il osuser
but i have one more string "v$session"
here i want to grep in which file these two strings are present.
any help is appreciated,
Thanks in advance.
Gagan (2 Replies)
Discussion started by: gagan4599
2 Replies
7. Shell Programming and Scripting
Removed (15 Replies)
Discussion started by: saisneha
15 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I'm trying to get lines from a file using identifiers in the first two columns. I have used:
cat MasterFile.txt | grep -f Pattern.txt
and the lines I want display on screen. If I try to put them in a file the file is created but stays empty:
cat MasterFile.txt | grep -f Pattern.txt... (14 Replies)
Discussion started by: FGPonce
14 Replies
9. Shell Programming and Scripting
Hi All,
I want to use egrep on multiple files and the results should be output to multiple files. I am using the below code in my shell script(working in Ksh shell). However with this code I am not attaining the desired results.
#!/bin/ksh
(
a="/path/file1"
b="path/file2"
for file in... (4 Replies)
Discussion started by: am24
4 Replies
10. Shell Programming and Scripting
We have the data looks like below in a log file.
I want to generat files based on the string between two hash(#) symbol like below
Source:
#ext1#test1.tale2 drop
#ext1#test11.tale21 drop
#ext1#test123.tale21 drop
#ext2#test1.tale21 drop
#ext2#test12.tale21 drop
#ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies
uniq(1) User Commands uniq(1)
NAME
uniq - report or filter out repeated lines in a file
SYNOPSIS
uniq [-c | -d | -u] [-f fields] [-s char] [ input_file [output_file]]
uniq [-c | -d | -u] [-n] [ + m] [ input_file [output_file]]
DESCRIPTION
The uniq utility will read an input file comparing adjacent lines, and write one copy of each input line on the output. The second and suc-
ceeding copies of repeated adjacent input lines will not be written.
Repeated lines in the input will not be detected if they are not adjacent.
OPTIONS
The following options are supported:
-c Precedes each output line with a count of the number of times the line occurred in the input.
-d Suppresses the writing of lines that are not repeated in the input.
-f fields Ignores the first fields fields on each input line when doing comparisons, where fields is a positive decimal integer. A
field is the maximal string matched by the basic regular expression:
[[:blank:]]*[^[:blank:]]*
If fields specifies more fields than appear on an input line, a null string will be used for comparison.
-s chars Ignores the first chars characters when doing comparisons, where chars is a positive decimal integer. If specified in con-
junction with the -f option, the first chars characters after the first fields fields will be ignored. If chars specifies
more characters than remain on an input line, a null string will be used for comparison.
-u Suppresses the writing of lines that are repeated in the input.
-n Equivalent to -f fields with fields set to n.
+m Equivalent to -s chars with chars set to m.
OPERANDS
The following operands are supported:
input_file A path name of the input file. If input_file is not specified, or if the input_file is -, the standard input will be used.
output_file A path name of the output file. If output_file is not specified, the standard output will be used. The results are unspeci-
fied if the file named by output_file is the file named by input_file.
EXAMPLES
Example 1: Using the uniq command
The following example lists the contents of the uniq.test file and outputs a copy of the repeated lines.
example% cat uniq.test
This is a test.
This is a test.
TEST.
Computer.
TEST.
TEST.
Software.
example% uniq -d uniq.test
This is a test.
TEST.
example%
The next example outputs just those lines that are not repeated in the uniq.test file.
example% uniq -u uniq.test
TEST.
Computer.
Software.
example%
The last example outputs a report with each line preceded by a count of the number of times each line occurred in the file:
example% uniq -c uniq.test
2 This is a test.
1 TEST.
1 Computer.
2 TEST.
1 Software.
example%
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of uniq: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO
comm(1), pack(1), pcat(1), sort(1), uncompress(1), attributes(5), environ(5), standards(5)
SunOS 5.10 20 Dec 1996 uniq(1)