02-24-2011
Comparison and deletion of lines between two files
Hi i need an help. I have two files list1 and list2, both contains the server names i want to delete the servers in list2 which were also found in list1.
for an eg
HTML Code:
list2 list1
oradg1 oradg4
oradg2 oradg2
oradg3 oradg3
oradg4 j2ee1
j2ee1
j2ee2
j2ee3
j2ee4
i want o/p ot be like this
HTML Code:
list2
oradg1
j2ee2
j2ee3
j2ee4
I new to this unix , so please help.
Thanks in advance
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a list of directories which contain old files that are to be deleted.
I put the list of all directories in a txt file and it is being read by a script
Iam searching for the files older than 60 days using mtime and then deleting it
But all the files are getting deleted... (3 Replies)
Discussion started by: Chidvilas
3 Replies
2. UNIX for Dummies Questions & Answers
We have log files dating back to 2004. I need to write an interative script that will request the user for how many months he needs to keep the log files and remove all the remaing log files after that month.
Supposing we are now in June 2006 , if teh user request to keep log file for the last 3... (1 Reply)
Discussion started by: Geeta
1 Replies
3. Shell Programming and Scripting
Hi Everyone,
Please help me with this. I have gone through many posts here but couldn't find what I wanted.
I have a file with 79000+ lines and I want to delete lines in a pattern.
I want to delete every 141st line in the file, starting from line 2000 till 50000.
Please help guys.
... (8 Replies)
Discussion started by: max29583
8 Replies
4. Shell Programming and Scripting
Hi, This is possibly an odd request to do with permissions as I seem to have tied myself up with these!
I have the following directory (see below) that contains files that the 'usergrp' user needs to be able to 'delete' files from.
drwxr-s--- 2 usergrp usergrp 512 16 Feb 14:37... (2 Replies)
Discussion started by: Peejay
2 Replies
5. UNIX for Dummies Questions & Answers
I have below file say temp1
BSCAJM1:HWJA10C
BSCAJM1:
BSCALW1:
BSCALW1:GVND01B
BSCALW1:
BSCALW1:
BSCBKNR:IJNMKTA
BSCBKNR:
BSCJOD1:
BSCJOD1:JOD121B
i want to delete all the lines ending with : and have below output
BSCAJM1:HWJA10C
BSCALW1:GVND01B
BSCBKNR:IJNMKTA... (8 Replies)
Discussion started by: lalchand
8 Replies
6. Shell Programming and Scripting
Hi, everyone. Could you help me with deletion of files, which are 20 minutes old.
I found out how to make deletion for files in that way :
find <dir> -mtime n -exec rm -rf "{}"
Could you offer your suggestions.
Many thanks in advance. (5 Replies)
Discussion started by: KReoN
5 Replies
7. Shell Programming and Scripting
Hi All ,
Given a file , I need to delete , modify and insert lines matching certain patterns in that file using shell scripting.
e.g. If a file FILE1 has following content :
CUST.ABC.DEF = CUST.ABC.DEF * CUST.ABC.DEF
PRINTF(CUST.ABC.DEF)
CUST.ABC.DEF = mid(CUST.ABC.DEF,10.34)... (5 Replies)
Discussion started by: swapnil.nawale
5 Replies
8. Shell Programming and Scripting
Hi all,
In the given file, what I need to do is to select double (or triple) occurring files and delete the one having smaller file size. And would like to keep the one with the big file size.
518t-rw-r--r-- 1 emily us_cms 101348458 Oct 8 16:43 vgtree_518_0_LHB.root
518t-rw-r--r-- 1... (9 Replies)
Discussion started by: emily
9 Replies
9. Debian
Hi,
The other day i installed a PHP based CMS (modx) on my shell account and noticed that i couldn't delete any of files/dirs it created after.
Also, i noticed that all that stuff is owned by username-www instead of username.
I tried chown, chmod and using a PHP script to do the same wti... (4 Replies)
Discussion started by: pentago
4 Replies
10. Shell Programming and Scripting
Hi,
I am in stage of post processing some of my results. I wanted to plot the data against the three axis x,y,z. The data file is quite complicated and i have to take the average of x, y,z over different steps of my test. A typical file look like below:
Time taken:4s
No.of series : 3... (6 Replies)
Discussion started by: begin_shell
6 Replies
LEARN ABOUT DEBIAN
libtar_list_new
libtar_list_new(3) C Library Calls libtar_list_new(3)
NAME
libtar_list_new, libtar_list_free, libtar_list_next, libtar_list_prev, libtar_list_add, libtar_list_del, libtar_list_search, lib-
tar_list_dup, libtar_list_merge, libtar_list_add_str - linked list routines
SYNOPSIS
#include <libtar.h>
libtar_list_t *libtar_list_new(int flags, int (*cmpfunc)());
void libtar_list_free(libtar_list_t *l, void (*freefunc)());
int libtar_list_add_str(libtar_list_t *l, char *str, char *delim);
int libtar_list_add(libtar_list_t *l, void *data);
void libtar_list_del(libtar_list_t *l, libtar_node_t **n);
int libtar_list_search(libtar_list_t *l, libtar_node_t **n, void *data, int (*matchfunc)());
int libtar_list_next(libtar_list_t *l, libtar_node_t **n);
int libtar_list_prev(libtar_list_t *l, libtar_node_t **n);
libtar_list_t *libtar_list_dup(libtar_list_t *l);
libtar_list_t *libtar_list_merge(int (*cmpfunc)(), int flags, libtar_list_t *list1, libtar_list_t *list2);
DESCRIPTION
The libtar_list_new() function creates a new list. The flags argument must be one of the following values:
LIST_USERFUNC
The cmpfunc argument points to a user-supplied function which determines the ordering of the list.
LIST_STACK
Use the list as a stack. New elements are added to the front of the list.
LIST_QUEUE
Use the list as a queue. New elements are added to the end of the list.
The libtar_list_free() function deallocates all memory associated with the list l. If freefunc is not NULL, it is called to free memory
associated with each node in the list.
The libtar_list_add() function adds the element pointed to by data to the list l. The position of the new element will be determined by
the flags passed to libtar_list_new() when the list was created.
The libtar_list_add_str() function tokenizes the string str using the delimiter characters in the string delim. The resulting tokens are
added to list l using libtar_list_add().
The libtar_list_search() function searches for an element which matches data using the matching function matchfunc. If matchfunc is NULL,
a default matching function designed for ASCII strings is used. Searching begins from the node pointed to by n.
The libtar_list_del() function removes the entry pointed to by n from the list pointed to by l.
The libtar_list_dup() function creates a copy of the list l using dynamically allocated memory.
The libtar_list_merge() function creates a new list with flags and cmpfunc, in the same way as libtar_list_new(). It then adds all ele-
ments from list1 and list2 using libtar_list_add().
RETURN VALUE
The libtar_list_new(), libtar_list_dup(), and libtar_list_merge() functions return a pointer to the new list structure, or NULL on error.
The libtar_list_next(), libtar_list_prev(), and libtar_list_search() functions return 1 when valid data is returned, or 0 otherwise.
The libtar_list_add() and libtar_list_add_str() functions return 0 on success, or -1 on error.
SEE ALSO
libtar_hash_new(3)
University of Illinois Jan 2000 libtar_list_new(3)