Sponsored Content
Top Forums Shell Programming and Scripting uniq not working, so any alternate? Post 302521614 by debu182 on Wednesday 11th of May 2011 11:13:21 PM
Old 05-12-2011
uniq not working, so any alternate?

Hi,

I have these two files .

Code:
file1
/home/prog/bug/perl
/home/prog/bug/ant
/home/prog/bug/make
/home/prog/bug/gen
/home/prog/bug/tiff


file2
/home/prog/bug/make
/home/prog/bug/gen

i want a output file which should contain

Code:
file1-file2
/home/prog/bug/perl
/home/prog/bug/ant
/home/prog/bug/tiff

My code

Code:
cat file1 file2 > temp
sort temp > /dev/null
uniq -u temp > file3
rm -f temp

but i didnt get the required output. I am using tcsh.

So i need some idea to write this script.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

alternate rows of a file

hi all is there any process in which i can get alternate rows of a file.i want to do further processing on those alternate rows.i want to select row1,row3,row5.... like this from a file. (3 Replies)
Discussion started by: dr46014
3 Replies

2. Shell Programming and Scripting

Alternate way for echo.

Hi, Is there any other command echo does. if I am doing this operation for each line in my file. So its taking very long time to process more than 1000 records. Is there any alternative way to write the above if statement (5 Replies)
Discussion started by: senthil_is
5 Replies

3. Shell Programming and Scripting

alternate lines

Hi, I'm new to Unix. I want to read the all the lines from a text file and write the alternate lines into another file. Please give me a shell script solution. file1 ----- one two three four five six seven newfile(it should contain the alternate lines from the file1) ------- one... (6 Replies)
Discussion started by: pstanand
6 Replies

4. UNIX for Dummies Questions & Answers

Difference between plain "uniq" and "uniq -u"

Dear all, It's not entirely clear to me from manpage the difference between them. Why we still need "-u" flag? - monkfan (3 Replies)
Discussion started by: monkfan
3 Replies

5. Shell Programming and Scripting

Wants alternate to the Sleep option??

I am new to Shell Scripting and I need help to write the following script in a different format... This is the current script: #!/usr/bin/ksh environment=rms export environment . $AW_HOME/RETEK/exec/RETEK_ENVAR ls -ltr $MMPOS/RTLOG* | tr -s " " | cut -d " " -f9... (20 Replies)
Discussion started by: satyajit007
20 Replies

6. Shell Programming and Scripting

sed working as uniq 1st word only

Hello, everyone. I am having trouble figuring out sed command which emulates uniq. The task I want to do is that 2 consecutive lines in file should be considered the same using the first word only. Example: cat tmp.txt ddd eee aaa bbb ccc ddd eee fff asd fdd asd fdd bbb aaa bbb asd fgh... (4 Replies)
Discussion started by: motorcek
4 Replies

7. Shell Programming and Scripting

Cron for an alternate sunday

Hi again, I need to delete stats on every 2nd Sunday and I've try the following codes but unfortunately it didn't work. I'll really appreciate as always for your help. I'm on FreeBSD 8.2-STABLE. altsun.sh script: #!/bin/sh day = $(`date '+%e'`) if then rm... (9 Replies)
Discussion started by: user`
9 Replies

8. HP-UX

Alternate for wget

Hi, Whats the alternate for wget in HP-UX ? (4 Replies)
Discussion started by: mohtashims
4 Replies

9. Shell Programming and Scripting

Alternate for sed -i in AIX

Experts, At the moment I am working in AIX box where sed -i is not available. My requirement is as below Two files file1 and file2. file1 contains the IP address, its count. file2 contains the Hostname and its corresponding IP address. I would like get the IP address replaced with the apt... (7 Replies)
Discussion started by: sathyaonnuix
7 Replies
strmerge(1)						      General Commands Manual						       strmerge(1)

NAME
strmerge - batch string replacement SYNOPSIS
strmerge [-m prefix] [-p patternfile] [-s string] source-program... OPTIONS
Add prefix to message numbers in the output source program and source message catalog. You can use this prefix as a mnemonic. You must process source message catalogs that contain number prefixes using the mkcatdefs command. Message numbers will be in the form: <prefix><msg_num> Set numbers will be in the form: S_<prefix><set_num> If you process your input source program with the mkcatdefs command, the resulting source program and source message catalog might not be portable. For more information, see the Writing Software for the International Market. Use patternfile to match strings in the input source program. By default, the command searches for the pattern file in the current directory, your home directory and finally /usr/lib/nls. If you omit the -p option, the strmerge command uses a default patterns file that is stored in /usr/lib/nls/patterns. Write string at the top of the source message catalog. If you omit the -s option, strmerge uses the string specified in the $CATHEAD section of the patterns file. DESCRIPTION
The strmerge command reads the strings specified in the message file produced by strextract and replaces those strings with calls to the message file in the source program to create a new source program. The new version of source program has the same name as the input source program, with the prefix nl_. For example, if the input source program is named prog.c, the output source program is named nl_prog.c. You use this command to replace hard-coded messages (text strings identified by the strextract command) with calls to the catgets function and to create a source message catalog file. The source message catalog contains the text for each message extracted from your input source program. The strmerge command names the file by appending to the name of the input source program. For example, the source message catalog for the prog.c program is named prog.msg. You can use the source message catalog as input to the gencat command. At run time, the program reads the message text from the message catalog. By storing messages in a message catalog, instead of your pro- gram, you allow the text of messages to be translated to a new language or modified without the source program being changed. In the source-program argument, you name one or more source programs for which you want strings replaced. The strmerge command does not replace messages for source programs included using the #include directive. Therefore, you might want a source program and all the source programs it includes on a single strmerge command line. You can create a patterns file (as specified by patternfile ) to control how the strmerge command replaces text. The patterns file is divided into several sections, each of which is identified by a keyword. The keyword must start at the beginning of a new line, and its first character must be a dollar sign ($). Following the identifier, you specify a number of patterns. Each pattern begins on a new line and follows the regular expression syntax you use in the ed editor. For more information on the patterns file, see the patterns(4) refer- ence page. RESTRICTIONS
You can specify only one rewrite string for all classes of pattern matches. The strmerge command does not verify if the message text file matches the source file being rewritten. The strmerge command does not replace strings to files included with #include directive. You must run the strmerge command on these files separately. EXAMPLES
The following produces a message file prog.cat for a program called prog.c. % strextract -p c_patterns prog.c prog2.c % vi prog.str % strmerge -p c_patterns prog.c prog2.c % gencat prog.cat prog.msg prog2.msg % vi nl_prog.c % vi nl_prog2.c % cc nl_prog.c nl_prog2.c In this example, the strextract command uses the c_patterns file to determine which strings to match. The input source programs are named prog.c and prog2.c. If you need to remove any of the messages or extract one of the created strings, edit the resulting message file, prog.str. Under no condi- tions should you add to this file. Doing so could result in unpredictable behavior. You issue the strmerge command to replace the extracted strings with calls to the message catalog. In response to this command, strmerge creates the source message catalogs, prog.msg and prog2.msg, and the output source programs, nl_prog.c and nl_prog2.c. Before compiling the source programs, you must edit nl_prog.c and nl_prog2.c to include the appropriate catopen and catclose function calls. The gencat command creates a message catalog and the cc command creates an executable program. SEE ALSO
extract(1), gencat(1), strextract(1), trans(1), regexp(3), catopen(3), catgets(3), patterns(4) Writing Software for the International Market strmerge(1)
All times are GMT -4. The time now is 04:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy