Sponsored Content
Top Forums Shell Programming and Scripting Replace a string within a file.. with help of positions Post 302502219 by gopeezere on Monday 7th of March 2011 08:44:44 AM
Old 03-07-2011
Thanks a lot... For your time.... Made it work...

Gopi
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace 9-16 positions of a text file.

Hi i am having text file like this 40000201040005200213072009000000700000050744820906904421 40069300240005200713072009000000067400098543630000920442 i want to replace 9-16 positions of my txt file...by 1234567...in a single line command i.e 0400052....should be replaced by... (2 Replies)
Discussion started by: suryanarayana
2 Replies

2. Shell Programming and Scripting

awk script replace positions if certain positions equal prescribed value

I am attempting to replace positions 44-46 with YYY if positions 48-50 = XXX. awk -F "" '{if (substr($0,48,3)=="XXX") $44="YYY"}1' OFS="" $filename > $tempfile But this is not working, 44-46 is still spaces in my tempfile instead of YYY. Any suggestions would be greatly appreciated. (9 Replies)
Discussion started by: halplessProblem
9 Replies

3. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

4. Shell Programming and Scripting

Replace dashes positions 351-357 & 024-043 with 0 & replace " " if exis with 04 at position 381-382

I need to replace dashes (i.e. -) if present from positions 351-357 with zero (i.e. 0), I also need to replace dash (i.e “-“) if present between position 024-043 with zero (i.e. 0) & I replace " " (i.e. 2 space characters) if present at position 381-382 with "04". Total length of record is 413.... (11 Replies)
Discussion started by: lancesunny
11 Replies

5. Shell Programming and Scripting

if characters from positions 7-15 are matching 219 then replace al

Script for if characters from positions 7-15 are matching with characters from position 211-219 then replace all char from 211-219 with 9 space. Total length of record is 420. Here is the specification of the data in file. Position Field Data Type... (2 Replies)
Discussion started by: lancesunny
2 Replies

6. Shell Programming and Scripting

sed to replace specific positions on line with file contents

Hi, I am trying to use an awk command to replace specific character positions on a line beginning with 80 with contents of another file. The line beginning with 80 in file1 is as follows: I want to replace the 000000000178800 (positions 34 - 49) on this file with the contents of... (2 Replies)
Discussion started by: nwalsh88
2 Replies

7. UNIX for Dummies Questions & Answers

Replace alphabets from certain positions

Hi all, I have column 2 full of values like HIVE4A-56 and HIVE4-56. I want to convert all values like HIVE4A-56 to HIVE4-56. So basically I want to delete all single alphabets before the '-' which is always preceded by a number. Values already in the desired format should remain unchanged... (4 Replies)
Discussion started by: ames1983
4 Replies

8. Shell Programming and Scripting

Replace characters at fixed positions

My objective is to replace the 8th, 9th, 10th characters by 1 space per character (total 3 spaces) in a file. I achieved this using following command: sed 's/\(.\)/\1@/7;s/@\(...\)/ /' FileData.txt > FileData_UPDATED.txt Another situation comes when I need to done same but excluding 1st... (5 Replies)
Discussion started by: manishdivs
5 Replies

9. Shell Programming and Scripting

Replace multiple positions in records which match crireria

I have a test file a.txt 001 123 456 789 002 This is just a 001 test data 003 file. I want to clear columns 5 and 6 if the first 3 characters are 001 using awk. I tried following but does not work. Any suggestions? awk 'BEGIN{OFS=FS=""} {if (substr($0,1,3)=="123") $5=" "; $6="... (20 Replies)
Discussion started by: Soham
20 Replies

10. UNIX for Beginners Questions & Answers

Replace specific positions in a file

I have a fixed-length positional file. I am trying to replace content of position 4-13 (length=10) with xxxxxxxxxx. Sample 2 rows in this file: H0187459823 172SMITH, JOE H0112345678 172DOE, JANE In this example 87459823 (from 1st line) and 12345678 (from 2nd line) (both in position... (3 Replies)
Discussion started by: Diver181
3 Replies
XtWorkProc()															      XtWorkProc()

Name
  XtWorkProc - interface definition for procedure called when the event loop is idle.

Synopsis
  typedef Boolean (*XtWorkProc)(XtPointer);
	 XtPointer client_data;

Inputs
  client_data
	    Specifies data registered with this procedure.

Returns
  True if the procedure should not be called again; False otherwise.

Description
  An XtWorkProc is registered with XtAppAddWorkProc() and is called by XtAppMainLoop() and XtAppProcessEvent() if there are no events pending
  and the application would otherwise block.

  The client_data argument is data of any type registered in the call to XtAppAddWorkProc().  It is generally cast to an XtPointer when  reg-
  istered  and cast back to the appropriate type within the XtWorkProc.  An XtWorkProc must get all of its context from this argument or from
  global variables.

  An XtWorkProc should perform a single short task and return.	If it does not return quickly then events that arrive  while  it  is  running
  will not be handled immediately, and the response time seen by the user will suffer.	If a work procedure has a lot of processing to do, it
  should perform a piece of it, save its state in static variables, and return False.  When an XtWorkProc returns False, the Intrinsics  will
  call	it again the next time the event loop is idle, and it can resume its processing where it left off.  When it completes all of its pro-
  cessing, it should return True, and the Intrinsics will automatically un-register it, so that it will not be called again.

Usage
  One possible use of work procedures is to create the widgets in dialog boxes which are not needed immediately when  an  application  starts
  up.	This will save start up time for the main application window, and will probably also mean that the dialog boxes will be fully created
  by the time the user requests that one is popped up.

  You can register multiple work procedures, and they will be performed one at a time.	The most recent work procedure added has the  highest
  priority.  Therefore, for example, if you want to create ten popup widgets during idle time, you might add ten work procedures.  The pop up
  that you expect to need first should be created by the last work procedure registered.  See the example below for  an  alternate  approach,
  however.

  You can explicitly remove a work procedure with XtRemoveWorkProc().

Example
  The  first  procedure below is an XtWorkProc that creates several dialog widgets.  Note that it returns after creating each dialog.  If the
  dialogs are needed before they are created by this procedure, they will have to be created explicitly as  shown  in  the  second  procedure
  below.   The	only  standard client in X11R5 that uses work procedures is xfontsel which performs sophisticated scheduling of all the back-
  ground work of parsing the names of all the fonts available from the server.

     Widget file_dialog = NULL;
     Widget print_dialog = NULL;
     Widget confirm_dialog = NULL;

     Boolean CreateDialogsInBackground(client_data)
     XtPointer client_data;
     {
	 Widget toplevel = (Widget) client_data;
	 static int num = 0;

	 num++;

	 switch(num) {
	 case 1:
	     if (file_dialog == NULL)
		 file_dialog = CreateFileDialog(toplevel);
	     return False;
	 case 2:
	     if (print_dialog == NULL)
		 print_dialog = CreatePrintDialog(toplevel);
	     return False;
	 case 3:
	     if (confirm_dialog == NULL)
		confirm_dialog = CreateConfirmDialog(toplevel);
	     return True;
	 }
	 return True;
     }

     void DoFileDialog(toplevel)
     Widget toplevel;
     {
	 if (file_dialog == NULL)
	     file_dialog = CreateFileDialog(toplevel);
	 XtPopup(file_dialog, XtGrabExclusive);
     }

  This work procedure could be registered with a call like the following:

	 toplevel = XtAppInitialize(...);
	 BuildInterface(toplevel);
	 XtRealizeWidget(toplevel);

	 XtAppAddWorkProcedure(app_context, CreateDialogsInBackground,
			       (XtPointer) toplevel);

	 XtAppMainLoop(app_context);

See Also
  XtAppAddWorkProc(1), XtRemoveWorkProc(1).

Xt - Event Handling														      XtWorkProc()
All times are GMT -4. The time now is 02:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy