Sponsored Content
Full Discussion: Replace 2nd column in file
Top Forums Shell Programming and Scripting Replace 2nd column in file Post 302745129 by sdosanjh on Sunday 16th of December 2012 08:20:57 PM
Old 12-16-2012
Replace 2nd column in file

I have following entries file abc.txt

Code:
abc83.out.remote           TRUE
abc84.out.remote           TRUE
abc85.out.remote           TRUE
abc86.out.remote           TRUE

Please help me, how do i toggle the entries listed in 2nd column based on the search patterns (abcxx)

abcxx, i can get using for loop, my problem is to replace the corresponding 2nd column entries (TRUE/FALSE)
Creating a tmp file for this is not a problem. Also. 3 tab spaces after 1st column should be preserved after replacing TRUE with FALSE or vice versa.
Please help

Last edited by sdosanjh; 12-16-2012 at 09:27 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2

Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2 file 1 sample SNDK 80004C101 AT XLNX 983919101 BB NETL 64118B100 BS AMD 007903107 CC KLAC 482480100 DC TER 880770102 KATS ATHR 04743P108 KATS... (7 Replies)
Discussion started by: rydz00
7 Replies

2. Shell Programming and Scripting

Replace column with column from another file

Hello, I am trying to replace the column in file1 with the column from file2. The two files will have the same amount of rows. Each row will correspond with the same row in the other file. File1 "Replace this column" 500 13-APR-2011... (11 Replies)
Discussion started by: doobe01
11 Replies

3. Shell Programming and Scripting

comparing column of two different files and print the column from in order of 2nd file

Hi friends, My file is like: Second file is : I need to print the rows present in file one, but in order present in second file....I used while read gh;do awk ' $1=="' $gh'" {print >> FILENAME"output"} ' cat listoffirstfile done < secondfile but the output I am... (14 Replies)
Discussion started by: CAch
14 Replies

4. Shell Programming and Scripting

Replace 2nd column of CSV file with numbers on line

I have a csv file with occasional multiple entries in the second column. 111111,104,07-24-2011,3.15,N, 222222,020 140,07-24-2011,10.00,N,I want the result 111111,104,07-24-2011,3.15,N, 222222,020,07-24-2011,10.00,N, 222222,140,07-24-2011,10.00,N, I know I can get the output of the second... (5 Replies)
Discussion started by: ffdstanley
5 Replies

5. Shell Programming and Scripting

Replace 2nd column for each line in a csv file with fixed string+random number

Hi experts, My csv file looks like this U;cake;michael;temp;;;; U;bread;john;temp;;;; U;cocktails;sarah;temp;;;; I'd like to change the value fo 2nd column to cf+random number , which will look maybe something like this U;cf20187;michael;temp;;;; U;cf8926;john;temp;;;;... (7 Replies)
Discussion started by: tententen
7 Replies

6. Shell Programming and Scripting

Replace column that matches specific pattern, with column data from another file

Can anyone please help with this? I have 2 files as given below. If 2nd column of file1 has pattern foo1@a, find the matching 1st column in file2 & replace 2nd column of file1 with file2's value. file1 abc_1 foo1@a .... abc_1 soo2@a ... def_2 soo2@a .... def_2 foo1@a ........ (7 Replies)
Discussion started by: prashali
7 Replies

7. Shell Programming and Scripting

Change the text in 2nd column in file

Legends, I have following entries in a file. I want to toggle the entry of 2nd column. TRUE/FALSE i tried using perl -p -i -e but the problem is, if instead of "tab" space after 1st column, there is a character or multi character space then this won't work. perl -p -i -e... (6 Replies)
Discussion started by: sdosanjh
6 Replies

8. Shell Programming and Scripting

Replace 2nd Column

Dear All, I have data like this, input.txt A 0B 1828 C 100D 1666,C 200D 1727,C 300D 1783, A 0B 1786 C 200D 1727,C 100D 1666,C 300D 1783, C 400D 1812,C 600D 1869,C 500D 1841, C 400D 1812,C 500D 1841,C 600D 1869, A 0B 1349 C 200D 1727,C 300D 1783,C 100D... (1 Reply)
Discussion started by: attila
1 Replies

9. Shell Programming and Scripting

Match column 8 in file 1 with column 2 in file 2 and replace..

I am looking at the NR==FNR posts and trying to use them to achieve the following but I am not getting it. I have 2 files. I want to match column 8 in file 1 with column 2 in file 2. When they match I want to replace column 9 in file 1 with column 1 in file 2. This is and extract from file 1 ... (5 Replies)
Discussion started by: kieranfoley
5 Replies

10. UNIX for Beginners Questions & Answers

Compare 1st column from 2 file and if match print line from 1st file and append column 7 from 2nd

hi I have 2 file with more than 10 columns for both 1st file apple,0,0,0...... orange,1,2,3..... mango,2,4,5..... 2nd file apple,2,3,4,5,6,7... orange,2,3,4,5,6,8... watermerlon,2,3,4,5,6,abc... mango,5,6,7,4,6,def.... (1 Reply)
Discussion started by: tententen
1 Replies
xdr_simple(3NSL)				       Networking Services Library Functions					  xdr_simple(3NSL)

NAME
xdr_simple, xdr_bool, xdr_char, xdr_double, xdr_enum, xdr_float, xdr_free, xdr_hyper, xdr_int, xdr_long, xdr_longlong_t, xdr_quadruple, xdr_short, xdr_u_char, xdr_u_hyper, xdr_u_int, xdr_u_long, xdr_u_longlong_t, xdr_u_short, xdr_void - library routines for external data representation SYNOPSIS
#include<rpc/xdr.h> bool_t xdr_bool(XDR *xdrs, bool_t *bp); bool_t xdr_char(XDR *xdrs, char *cp); bool_t xdr_double(XDR *xdrs, double *dp); bool_t xdr_enum(XDR *xdrs, enum_t *ep); bool_t xdr_float(XDR *xdrs, float *fp); void xdr_free(xdrproc_t proc, char *objp); bool_t xdr_hyper(XDR *xdrs, longlong_t *llp); bool_t xdr_int(XDR *xdrs, int *ip); bool_t xdr_long(XDR *xdrs, longt *lp); bool_t xdr_longlong_t(XDR *xdrs, longlong_t *llp); bool_t xdr_quadruple(XDR *xdrs, long double *pq); bool_t xdr_short(XDR *xdrs, short *sp); bool_t xdr_u_char(XDR *xdrs, unsigned char *ucp); bool_t xdr_u_hyper(XDR *xdrs, u_longlong_t *ullp); bool_t xdr_u_int(XDR *xdrs, unsigned *up); bool_t xdr_u_long(XDR *xdrs, unsigned long *ulp); bool_t xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp); bool_t xdr_u_short(XDR xdrs, unsigned short *usp); bool_t xdr_void(void) DESCRIPTION
The XDR library routines allow C programmers to describe simple data structures in a machine-independent fashion. Protocols such as remote procedure calls (RPC) use these routines to describe the format of the data. These routines require the creation of XDR streams (see xdr_create(3NSL)). Routines See rpc(3NSL) for the definition of the XDR data structure. Note that any buffers passed to the XDR routines must be properly aligned. It is suggested that malloc(3C) be used to allocate these buffers or that the programmer insure that the buffer address is divisible evenly by four. xdr_bool() xdr_bool() translates between booleans (C integers) and their external representations. When encoding data, this fil- ter produces values of either 1 or 0. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_char() xdr_char() translates between C characters and their external representations. This routine returns TRUE if it suc- ceeds, FALSE otherwise. Note: encoded characters are not packed, and occupy 4 bytes each. For arrays of characters, it is worthwhile to consider xdr_bytes(), xdr_opaque(), or xdr_string() (see xdr_complex(3NSL)). xdr_double() xdr_double() translates between C double precision numbers and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_enum() xdr_enum() translates between C enums (actually integers) and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_float() xdr_float() translates between C floats and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_free() Generic freeing routine. The first argument is the XDR routine for the object being freed. The second argument is a pointer to the object itself. Note: the pointer passed to this routine is not freed, but what it points to is freed (recursively, depending on the XDR routine). xdr_hyper() xdr_hyper() translates between ANSI C long long integers and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_int() xdr_int() translates between C integers and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_long() xdr_long() translates between C long integers and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. In a 64-bit environment, this routine returns an error if the value of lp is outside the range [INT32_MIN, INT32_MAX]. The xdr_int() routine is recommended in place of this routine. xdr_longlong_t() xdr_longlong_t() translates between ANSI C long long integers and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. This routine is identical to xdr_hyper(). xdr_quadruple() xdr_quadruple() translates between IEEE quadruple precision floating point numbers and their external representa- tions. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_short() xdr_short() translates between C short integers and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_u_char() xdr_u_char() translates between unsigned C characters and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_u_hyper() xdr_u_hyper() translates between unsigned ANSI C long long integers and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_u_int() A filter primitive that translates between a C unsigned integer and its external representation. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_u_long() xdr_u_long() translates between C unsigned long integers and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. In a 64-bit environment, this routine returns an error if the value of ulp is outside the range [0, UINT32_MAX]. The xdr_u_int() routine is recommended in place of this routine. xdr_u_longlong_t() xdr_u_longlong_t() translates between unsigned ANSI C long long integers and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. This routine is identical to xdr_u_hyper(). xdr_u_short() xdr_u_short() translates between C unsigned short integers and their external representations. This routine returns TRUE if it succeeds, FALSE otherwise. xdr_void() This routine always returns TRUE. It may be passed to RPC routines that require a function parameter, where nothing is to be done. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------------------------------------+ | ATTRIBUTE TYPE ATTRIBUTE VALUE | |MT-Level Safe | +-----------------------------------------------------------+ SEE ALSO
malloc(3C), rpc(3NSL), xdr_admin(3NSL), xdr_complex(3NSL), xdr_create(3NSL), attributes(5) SunOS 5.11 27 Aug 2001 xdr_simple(3NSL)
All times are GMT -4. The time now is 06:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy