to replace one character by numbers in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting to replace one character by numbers in a file
# 8  
Old 10-07-2007
awk

hi,

Code:
awk '{print $1" "substr($2,1,1)$3substr($2,3,1)}' filename

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Use awk to replace numbers in a file with a column from another file

Hello, I am trying to make a awk code that will take 2 files, a txt file like this : 1 1 88 c(1:38, 42, 102) 2 2 128 c(39:41, 43:101, 103:105, 153, 155:189, 292, 344:369) 3 3 84 c(190:249, 603, 606:607, 609:629) 4 4 12 ... (8 Replies)
Discussion started by: nastaziales
8 Replies

2. Shell Programming and Scripting

Replace character in a file.

I have a data like this in a file. 05/08/2017,U,01,116326001 05/08/2017,U,01,116226001 05/08/2017,U,01,116726323 05/08/2017,U,01,116236001 I want replace the date(1st column) of all records. Ex: 05/08/2017 to 04/02/2017 Please use CODE tags when displaying sample input, sample output,... (1 Reply)
Discussion started by: Artlk
1 Replies

3. Shell Programming and Scripting

Delete Numbers, Spaces, Special Character from the begining of the line of a file

Hi All, I want to keep the name of the songs with their respective extensions only. Sample Code ======== 03 Choti choti gaiya choti choti gaval.mp3 03---Brazil Dhol.mp3 03 PAYALIYA .mp3 04 - Isq Risk .mp3 04%20-%20Oh%20My%20Love(wapking.in).mp3 08 - A2 - Aasan Nahin Yahan .mp3 AE... (3 Replies)
Discussion started by: Pramod_009
3 Replies

4. Shell Programming and Scripting

Replace a character in a file

Hello, Can anyone help me? I need to replace the letters (A, B, C..) of the second column in this file by a number i.e. 1. current file 0123456 0A123 0003355 Marion 1234567 0B117 0003388 Anthony 1112333 0C345 0459877 Ann new file 0123456 01123 0003355 Marion 1234567 ... (3 Replies)
Discussion started by: Lilu_CK
3 Replies

5. Shell Programming and Scripting

find all numbers > x and replace with y within a file

How would I do this? How could i use <> symbols for numbers in the find/replace code below? perl -pi -e 's/test/tst/' OR is there a better way? 100 5000 2 432 4 2 33 4 5 6 65 300 301 needs to be: 100 300 2 300 4 2 33 4 5 6 65 300 300 also it might not always need spaces... i... (12 Replies)
Discussion started by: herot
12 Replies

6. Shell Programming and Scripting

count numbers of matching rows and replace its value in another file

Hello all, can you help me in this problem, assume We have two txt file (file_1 and file_3) one is file_1 contains the data: a 0 b 1 c 3 a 7 b 4 c 5 b 8 d 6 . . . . and I need to count the lines with the matching data (a,b,..) and print in new file called file_2 such as the... (4 Replies)
Discussion started by: GoldenFalcon10
4 Replies

7. Shell Programming and Scripting

read in a file character by character - replace any unknown ASCII characters with spa

Can someone help me to write a script / command to read in a file, character by character, replace any unknown ASCII characters with space. then write out the file to a new filename/ Thanks! (1 Reply)
Discussion started by: raghav525
1 Replies

8. Shell Programming and Scripting

How to replace a character in the file?

Hi All, I have file contains the following information. chem00s4.mis.amat.com ] Critical 3/21 chem00s4.mis.amat.com ] Normal 3/22 chem00s4.mis.amat.com ] Normal 3/23 chem00s4.mis.amat.com ] Normal 3/24 chem00s4.mis.amat.com ] Critical 3/25... (2 Replies)
Discussion started by: ntgobinath
2 Replies

9. AIX

How to replace many numbers with one number in a file

How to replace many numbers with one number in a file. Many numbers like 444565,454678,443298,etc. i want to replace these with one number (300).Please halp me out. (2 Replies)
Discussion started by: vpandey
2 Replies

10. Shell Programming and Scripting

How to replace a character in a file

Hi, I want to replace a character in every line in the file say the file looks like this SOBO20060830094122140014541834 WENP0414541835 ] SOBO20060830094121140014541834 WENP0414541835 SOBO20060830094121140014541834 WENP0414541835 I want to replace the blue 00 by TS. (6 Replies)
Discussion started by: preethgideon
6 Replies
Login or Register to Ask a Question
I386_PMC_INFO(2)					   BSD/i386 System Calls Manual 					  I386_PMC_INFO(2)

NAME
i386_pmc_info, i386_pmc_startstop, i386_pmc_read -- interface to CPU performance counters LIBRARY
i386 Architecture Library (libi386, -li386) SYNOPSIS
#include <sys/types.h> #include <machine/sysarch.h> #include <machine/specialreg.h> int i386_pmc_info(struct i386_pmc_info_args *ia); int i386_pmc_startstop(struct i386_pmc_startstop_args *ssa); int i386_pmc_read(struct i386_pmc_read_args *ra); DESCRIPTION
These functions provide an interface to the CPU performance counters on the 586-class and 686-class processors. i386_pmc_info() will return information about the available CPU counters. The information is returned in ia having the following structure: struct i386_pmc_info_args { int type; int flags; }; The type member describes the class of performance counters available. Valid values are: PMC_TYPE_NONE No PMC support PMC_TYPE_I586 586-class CPUs PMC_TYPE_I686 686-class Intel CPUs PMC_TYPE_K7 686-class AMD CPUs The flags member describes additional capabilities of the processor. Valid values are: PMC_INFO_HASTSC CPU has time-stamp counter i386_pmc_startstop() is used to start and stop the measurement of the CPU performance counters. The argument ssa has the following struc- ture: struct i386_pmc_startstop_args { int counter; uint64_t val; uint8_t event; uint8_t unit; uint8_t compare; uint8_t flags; }; The counter specified by the member counter is started if the member flags has PMC_SETUP_KERNEL or PMC_SETUP_USER set, otherwise the counter is stopped. The initial value of the counter is set to val. Additional values for the flags member are PMC_SETUP_EDGE and PMC_SETUP_INV. The event member specifies some event written to the control register. The unit member specifies the measurement units. The compare member is a mask for the counter. i386_pmc_read() will return information about a specific CPU counter measured during the last measurement period determined by the calling of i386_pmc_startstop(). The information is returned in ra having the following structure: struct i386_pmc_read_args { int counter; uint64_t val; uint64_t time; }; The counter to read should be specified by the counter member. Counters are numbered from 0 to PMC_NCOUNTERS. The value of the counter is returned in the val member. The time since epoch, measured in CPU clock cycles, is returned in the time member. RETURN VALUES
Upon successful completion zero is returned, otherwise -1 is returned on failure. BSD
November 10, 2001 BSD