Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Replace only column 1 entries Post 302966554 by Aia on Saturday 13th of February 2016 10:47:51 AM
Old 02-13-2016
A different option:
Code:
perl -pe 's/^MFTR010+(\d+)\S*/product$1/' pita_m.file > result.file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace 10th column with a new column--- Terriblly hurry

Hi Can any one tell me how to replace the 10th column in a file(comma delimted) with a new file with a single column. Can any one Help me out of the please as soon as possible as i am in a terribley hurry!!!!!! Many THanks, (2 Replies)
Discussion started by: ahmedwaseem2000
2 Replies

2. UNIX for Advanced & Expert Users

replace a column values with the first value in column

Hi All, I have a file which has data in following format: "Body_Model","2/1/2007","2/1/2007" "CSCH74","0","61" "CSCS74","0","647" "CSCX74","0","3" "CSYH74","0","299" "CSYS74","0","2514" "CSYX74","0","3" "Body_Model","3/1/2007","3/1/2007" "CSCH74","0","88" "CSCS74","0","489"... (3 Replies)
Discussion started by: sumeet
3 Replies

3. Shell Programming and Scripting

awk/sed column replace using column header - help

$ cat log.txt Name Age Sex Lcation nfld alias xsd CC 25 M XYZ asx KK Y BB 21 F XAS awe SS N SD 21 M AQW rty SD A How can I replace the column with header "Lcation" with the column with header "alias" and delete the "alias" column? so that the final output will become: Name Age Sex... (10 Replies)
Discussion started by: jkl_jkl
10 Replies

4. 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

5. 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

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. UNIX for Dummies Questions & Answers

column replace

Hello. I'm trying to replace the 1st column of text with the word Blue. The string is text and numbers. Trying to learn awk and have been searching forums but can't come up with anything. Any help would be appreciated. (4 Replies)
Discussion started by: jimmyf
4 Replies

8. Shell Programming and Scripting

Replace column help

I have a pipe delimited file. Below are the contents order_id|line_id|retail|cost 2324|1|99.99|50 89793|23|100|23.99 90989|9|23|76.50|56.5 I need to zero out the 3rd column(retail) Below is what i want order_id|line_id|retail|cost 2324|1|0|50 89793|23|0|23.99 90989|9|23|0|56.5 ... (5 Replies)
Discussion started by: venky338
5 Replies

9. Shell Programming and Scripting

Get extract and replace column with link in a column where it exists

hi i have sample data a,b,c,d,e,g h http://mysite.xyx z,b,d,f,e,s t http://123124# a,b,c,i,m,nothing d,i,j,e,w,nothing output expected is a,b,c,d,e,http://mysite.xyx z,b,d,f,e,http://123124# a,b,c,i,m,nothing d,i,j,e,w,nothing i can get only links using grep -o 'http.*' i... (8 Replies)
Discussion started by: zozoo
8 Replies

10. UNIX for Beginners Questions & Answers

awk script to extract a column, replace one of the header and replace year(from ddmmyy to yyyy)

I have a csv which has lot of columns . I was looking for an awk script which would extract a column twice. for the first occurance the header and data needs to be intact but for the second occurance i want to replace the header name since it a duplicate and extract year value which is in ddmmyy... (10 Replies)
Discussion started by: Kunalcurious
10 Replies
explain_mkostemp(3)					     Library Functions Manual					       explain_mkostemp(3)

NAME
explain_mkostemp - explain mkostemp(3) errors SYNOPSIS
#include <libexplain/mkostemp.h> const char *explain_mkostemp(char *templat, int flags); const char *explain_errno_mkostemp(int errnum, char *templat, int flags); void explain_message_mkostemp(char *message, int message_size, char *templat, int flags); void explain_message_errno_mkostemp(char *message, int message_size, int errnum, char *templat, int flags); DESCRIPTION
These functions may be used to obtain explanations for errors returned by the mkostemp(3) system call. explain_mkostemp const char *explain_mkostemp(char *templat, int flags); The explain_mkostemp function is used to obtain an explanation of an error returned by the mkostemp(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. templat The original template, exactly as passed to the mkostemp(3) system call. flags The original flags, exactly as passed to the mkostemp(3) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. Example: This function is intended to be used in a fashion similar to the following example: int result = mkostemp(templat, flags); if (result < 0) { fprintf(stderr, "%s ", explain_mkostemp(templat, flags)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_mkostemp_or_die(3) function. explain_errno_mkostemp const char *explain_errno_mkostemp(int errnum, char *templat, int flags); The explain_errno_mkostemp function is used to obtain an explanation of an error returned by the mkostemp(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. templat The original template, exactly as passed to the mkostemp(3) system call. flags The original flags, exactly as passed to the mkostemp(3) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. Example: This function is intended to be used in a fashion similar to the following example: int result = mkostemp(templat, flags); if (result < 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_mkostemp(err, templat, flags)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_mkostemp_or_die(3) function. explain_message_mkostemp void explain_message_mkostemp(char *message, int message_size, char *templat, int flags); The explain_message_mkostemp function is used to obtain an explanation of an error returned by the mkostemp(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. templat The original template, exactly as passed to the mkostemp(3) system call. flags The original flags, exactly as passed to the mkostemp(3) system call. Example: This function is intended to be used in a fashion similar to the following example: int result = mkostemp(templat, flags); if (result < 0) { char message[3000]; explain_message_mkostemp(message, sizeof(message), templat, flags); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_mkostemp_or_die(3) function. explain_message_errno_mkostemp void explain_message_errno_mkostemp(char *message, int message_size, int errnum, char *templat, int flags); The explain_message_errno_mkostemp function is used to obtain an explanation of an error returned by the mkostemp(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. templat The original template, exactly as passed to the mkostemp(3) system call. flags The original flags, exactly as passed to the mkostemp(3) system call. Example: This function is intended to be used in a fashion similar to the following example: int result = mkostemp(templat, flags); if (result < 0) { int err = errno; char message[3000]; explain_message_errno_mkostemp(message, sizeof(message), err, templat, flags); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_mkostemp_or_die(3) function. SEE ALSO
mkostemp(3) create a unique temporary file explain_mkostemp_or_die(3) create a unique temporary file and report errors COPYRIGHT
libexplain version 0.52 Copyright (C) 2009 Peter Miller explain_mkostemp(3)
All times are GMT -4. The time now is 01:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy