Sponsored Content
Full Discussion: Need to sort file
Top Forums Shell Programming and Scripting Need to sort file Post 302308124 by learnerlearner on Friday 17th of April 2009 07:03:32 AM
Old 04-17-2009
New requirement!! Need help

Quote:
Originally Posted by pludi
Useless use of '-u', redirection, a pipe, and cat. Wow. Just wow. Same can be done by running
Code:
sort example.txt

since a list of RPMs probably won't have any unnecessary doubles in it.
Thanks for the response...Now i have a requirement something like this. I have a script as below:

#!/bin/bash -vx
##VARIABLES used below are defined in my profile and am importing them before i use them
rm -f list.log
#Extract the RPMs from RPM Database on each of the server
for i in $SERVER; do
echo -n "$i" >> list.log
echo "" >> list.log
ssh $i 'rpm -qa | grep '$CURRENT_VER' ' >> list.log
done

#Extract Info from the Delivery Server
rm -f $DELIVERY_LOG
for j in $WEBDAV_SERVER; do
echo $DELIVER_DIR
ssh <user_name>@$j 'find '$DELIVER_DIR' -type f -name "vst3*.rpm" -printf %f\\n ' >> $DELIVERY_LOG
done

# Compare the files delivery and list two get the difference.
Now here is what i am facing the problem.
1. I need to sort the $DELIVERY_LOG taking only higher version of the RPM and make it $FINAL_LOG
2. I need to compare $FINAL_LOG with the list.log and i should get the output as below
the RPM in $FINAL_LOG is missing on the server *$i
Will i have to create a property file which has which all RPMs are present on each server first? or is there any other method

Could anyone help me out in this
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to sort a file

Hi, i want to sort a file by column 2, 3, 10 and 4(in this order), can anybody help me? thanks a lot. (2 Replies)
Discussion started by: tao
2 Replies

2. Shell Programming and Scripting

Sort a particular column in a file

Dear All, Good day. Here i am facing some problem like below. file contains 12345 0001 090112 14385 0001 090112 13255 0001 090112 11345 0001 090112 .... I want to sort ascending according to the first column. What will be the shell script. (4 Replies)
Discussion started by: saifurshaon
4 Replies

3. Shell Programming and Scripting

q's on file sort

I have a file below which has a list of users and roles with each row having unique combination of users and roles. USER1 ROLE1 USER1 ROLE2 USER2 USER3 ROLE1 USER3 ROLE2 USER3 ROLE3 USER4 ROLE2 .... .... I am trying to create a script which sorts the above file to have all the... (4 Replies)
Discussion started by: stevefox
4 Replies

4. Shell Programming and Scripting

How to Sort Floating Numbers Using the Sort Command?

Hi to all. I'm trying to sort this with the Unix command sort. user1:12345678:3.5:2.5:8:1:2:3 user2:12345679:4.5:3.5:8:1:3:2 user3:12345687:5.5:2.5:6:1:3:2 user4:12345670:5.5:2.5:5:3:2:1 user5:12345671:2.5:5.5:7:2:3:1 I need to get this: user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
Discussion started by: daniel.gbaena
7 Replies

5. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

6. Shell Programming and Scripting

Unix Scripting : Sort a Portion of a File and not the complete file

Need to sort a portion of a file in a Alphabetical Order. Example : The user adam is not sorted and the user should get sorted. I don't want the complete file to get sorted. Currently All_users.txt contains the following lines. ############## # ARS USERS ############## mike, Mike... (6 Replies)
Discussion started by: evrurs
6 Replies

7. Shell Programming and Scripting

Help with sort word and general numeric sort at the same time

Input file: 100%ABC2 3.44E-12 USA A2M%H02579 0E0 UK 100%ABC2 5.34E-8 UK 100%ABC2 3.25E-12 USA A2M%H02579 5E-45 UK Output file: 100%ABC2 3.44E-12 USA 100%ABC2 3.25E-12 USA 100%ABC2 5.34E-8 UK A2M%H02579 0E0 UK A2M%H02579 5E-45 UK Code try: sort -k1,1 -g -k2 -r input.txt... (2 Replies)
Discussion started by: perl_beginner
2 Replies

8. Shell Programming and Scripting

Sort help: How to sort collected 'file list' by date stamp :

Hi Experts, I have a filelist collected from another server , now want to sort the output using date/time stamp filed. - Filed 6, 7,8 are showing the date/time/stamp. Here is the input: #---------------------------------------------------------------------- -rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies

9. AIX

Sort file

as friends can only Sort this file with awk from low to high from position 3 to 9 bone this: 0003344 A70003344prueba1 A70003347prueba1 A70003345prueba1 A70003349prueba1 A70003343prueba1 A70003342prueba1 (4 Replies)
Discussion started by: tricampeon81
4 Replies

10. UNIX for Beginners Questions & Answers

How to align/sort the column pairs of an csv file, based on keyword word specified in another file?

I have a csv file as shown below, xop_thy 80 avr_njk 50 str_nyu 60 avr_irt 70 str_nhj 60 avr_ngt 50 str_tgt 80 xop_nmg 50 xop_nth 40 cyv_gty 40 cop_thl 40 vir_tyk 80 vir_plo 20 vir_thk 40 ijk_yuc 70 cop_thy 70 ijk_yuc 80 irt_hgt 80 I need to align/sort the csv file based... (7 Replies)
Discussion started by: dineshkumarsrk
7 Replies
getusershell(3C)					   Standard C Library Functions 					  getusershell(3C)

NAME
getusershell, setusershell, endusershell - get legal user shells SYNOPSIS
#include <unistd.h> char *getusershell(void); void setusershell(void); void endusershell(void); DESCRIPTION
The getusershell() function returns a pointer to a legal user shell as defined by the system manager in the file /etc/shells. If /etc/shells does not exist, the following locations of the standard system shells are used in its place: /bin/bash /bin/csh /bin/jsh /bin/ksh /bin/pfcsh /bin/pfksh /bin/pfsh /bin/sh /bin/tcsh /bin/zsh /sbin/jsh /sbin/pfsh /sbin/sh /usr/bin/bash /usr/bin/csh /usr/bin/jsh /usr/bin/ksh /usr/bin/pfcsh /usr/bin/pfksh /usr/bin/pfsh /usr/bin/sh /usr/bin/tcsh /usr/bin/zsh /usr/xpg4/bin/sh The getusershell() function opens the file /etc/shells, if it exists, and returns the next entry in the list of shells. The setusershell() function rewinds the file or the list. The endusershell() function closes the file, frees any memory used by getusershell() and setusershell(), and rewinds the file /etc/shells. RETURN VALUES
The getusershell() function returns a null pointer on EOF. BUGS
All information is contained in memory that may be freed with a call to endusershell(), so it must be copied if it is to be saved. SunOS 5.10 30 Aug 2004 getusershell(3C)
All times are GMT -4. The time now is 12:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy