Sponsored Content
Homework and Emergencies Emergency UNIX and Linux Support Replace nth position character of all the lines in file Post 302677693 by alister on Thursday 26th of July 2012 02:01:41 PM
Old 07-26-2012
Quote:
Originally Posted by balajesuri
Shorter:
Code:
sed 's/./X/149' input

To replace the 150th character, that should be 150, not 149.

Regards,
Alister
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Replace nth character in a file with a period

Hi all, If you look at the example below,I want to replace the 21st character (,) with a period (.). I have 1000 records in a file can someone help me how to do that. Thankyou all in advance. "2008-07-15... (3 Replies)
Discussion started by: blackhawk_123
3 Replies

2. Shell Programming and Scripting

Print lines with specific character at nth position in a file

I need to print lines with character S at nth position in a file...can someone pl help me with appropriate awk command for this (2 Replies)
Discussion started by: manaswinig
2 Replies

3. Shell Programming and Scripting

Print lines with specific character at nth position in a file

I need to print lines with character S at nth position in a file...can someone pl help me with appropriate awk command for this (1 Reply)
Discussion started by: manaswinig
1 Replies

4. UNIX for Dummies Questions & Answers

How to replace character on defined position

I need to replace the character on 6th position. If this character is 1 I have to repleace it with A, if it is 2 than I have to replace it with B. If it is not 1 or 2 I should not repleace it. input: abcd defg abcd 1efg mnop weac rstu 2bcd i need: abcd defg abcd Aefg mnop weac rstu... (2 Replies)
Discussion started by: necroman08
2 Replies

5. Shell Programming and Scripting

Replace character in certain position in a string

Hello everyone this is my first post of many to come :) I am writing a script and in this script at one point i need to replace a character in a particular position in a string for example: in the string "mystery" i would need to replace the 3rd position to an "r" so the string becomes... (3 Replies)
Discussion started by: snipaa
3 Replies

6. Shell Programming and Scripting

Find character and Replace character for given position

Hi, i want find the character '-' in a file from position 284-298, if it occurs i need to replace it with 'O ' for the position in the file. How to do that using SED command. thanks in advance, Sara (9 Replies)
Discussion started by: Sara183
9 Replies

7. Shell Programming and Scripting

To find nth position of character in string

Hi guyz i want to know nth position of character in string. For ex. var="UK,TK,HK,IND,AUS" now if we see 1st occurance of , is at 3 position, 2nd at 6,..4th at 13 position. 1st position we can find through INDEX, but what about 2nd,3rd and 4th or may be upto nth position. ? In oracle we had... (2 Replies)
Discussion started by: Jonty Immortal
2 Replies

8. Shell Programming and Scripting

awk script to replace nth character with comma

I have a requirement as below. In one of my column, I have data which may or may not be separted with coma always. Now I need to validate the length of these text within the coma (if available) and if the length is more than 30 characters, I need to insert a coma either at 30 characters if its... (3 Replies)
Discussion started by: aramacha
3 Replies

9. Shell Programming and Scripting

Replace nth to nth character?

Hi I got the following problem and I wonder if some could please help me out? I'd like to replace character 8 - 16 , 16 - 24 cat file ... (2 Replies)
Discussion started by: stinkefisch
2 Replies

10. Post Here to Contact Site Administrators and Moderators

Search for a pattern and replace a space at specific position with a Character in File

In file, we have millions of records each of 1000 in length. And at specific position say 800 there is a space, we need to replace it with Character X if the ID in that row starts with 123. So far i have used the below which is replacing space at that position to X but its not checking for... (3 Replies)
Discussion started by: Jagmeet Singh
3 Replies
pbind(1M)						  System Administration Commands						 pbind(1M)

NAME
pbind - control and query bindings of processes or LWPs SYNOPSIS
pbind -b processor_id pid [/lwpid]... pbind [-q] [pid [/lwpid]...] pbind -Q [processor_id...] pbind -u pid [/lwpid]... pbind -U [processor_id...] DESCRIPTION
pbind controls and queries bindings of processes and LWPs (lightweight processes) to processors. pbind can also remove processor bindings that were previously established. When an LWP is bound to a processor, it will be executed only by that processor except when the LWP requires a resource that is provided only by another processor. The binding is not exclusive, that is, the processor is free execute other LWPs as well. Bindings are inherited, so new LWPs and processes created by a bound LWP will have the same binding. Binding an interactive shell to a pro- cessor, for example, binds all commands executed by the shell. Superusers may bind or unbind any process or LWP, while other users can bind or unbind any process or LWP for which they have permission to signal, that is, any process that has the same effective user ID as the user. OPTIONS
The following options are supported: -b processor_id Binds all or a subset of the LWPs of the specified processes to the processor processor_id. Specify processor_id as the processor ID of the processor to be controlled or queried. processor_id must be present and on-line. Use the psrinfo command to determine whether or not processor_id is present and on-line. See psrinfo(1M). -q Displays the bindings of the specified processes or of all processes. If a process is composed of multiple LWPs which have different bindings and the LWPs are not explicitly specified, the bindings of only one of the bound LWPs will be displayed. The bindings of a subset of LWPs can be displayed by appending "/lwpids" to the process IDs. Multiple LWPs may be selected using "-" and "," delimiters. See EXAMPLES. -Q Displays the LWPs bound to the specified list of processors, or all LWPs with processor bindings. For processes composed of multiple LWPs, the bindings of individual LWPs will be displayed. -u Removes the bindings of all or a subset of the LWPs of the specified processes, allowing them to be executed on any on-line processor. -U Removes the bindings of all LWPs bound to the specified list of processors, or to any processor if no argument is specified. OPERANDS
The following operands are supported: pid The process ID of the process to be controlled or queried. lwpid The set of LWP IDs of the specified process to be controlled or queried. The syntax for selecting LWP IDs is as follows: 2,3,4-8 LWP IDs 2, 3, and 4 through 8 -4 LWPs whose IDs are 4 or below 4- LWPs whose IDs are 4 or above processor_id The processor ID of the processor to be controlled or queried. EXAMPLES
Example 1: Binding Processes The following example binds processes 204 and 223 to processor 2: example% pbind -b 2 204 223 process id 204: was 2, now 2 process id 223: was 3, now 2 Example 2: Unbinding a Process The following example unbinds process 204: example% pbind -u 204 Example 3: Querying Bindings The following example queries bindings. It demonstrates that process 1 is bound to processor 0, process 149 has at least one LWP bound to CPU3, and process 101 has no bound LWPs. example% pbind -q 1 149 101 process id 1: 0 process id 149: 3 process id 101: not bound Example 4: Querying LWP Bindings The following example queries bindings of LWPs. It demonstrates that LWP 1 of process 149 is bound to CPU3, and LWP 2 of process 149 is not bound. example% pbind -q 149/1-2 lwp id 149/1: 3 lwp id 149/2: not bound Example 5: Querying LWP Bindings for Processor 2: The following example queries all LWPs bound to processor 2: example% pbind -Q 2 lwp id 149/4: 2 lwp id 149/5: 2 ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. SEE ALSO
psradm(1M), psrinfo(1M), psrset(1M), processor_bind(2), processor_info(2), sysconf(3C), attributes(5) DIAGNOSTICS
pbind: cannot query pid 31: No suchprocess The process specified did not exist or has exited. pbind: cannot bind pid 31: Not owner The user does not have permission to bind the process. pbind: cannot bind pid 31: Invalid argument The specified processor is not on-line. SunOS 5.10 18 July 2004 pbind(1M)
All times are GMT -4. The time now is 01:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy