Sponsored Content
Top Forums Shell Programming and Scripting sed or awk command to replace a string pattern with another string based on position of this string Post 302656059 by vivek d r on Thursday 14th of June 2012 07:50:28 AM
Old 06-14-2012
totally awesome... :-) a million thanks guruprasad...
if you have time can you please explain how this command works?

---------- Post updated at 05:20 PM ---------- Previous update was at 05:16 PM ----------

is the command 'number of column' specific..? cause just now i tried with a big file and it dint work :-(

the above wont work for

Code:
INSERT INTO `Table44` (`id`, `action`, `date`, `description`, `modifiedId`, `object`, `performedById`, `schemaDifference_blob_reserved`, `schemaDifference_reserved`, `sourceIPAddress`, `zoneId`, `lastModified`) VALUES 
(1,'Change','2011-05-05 00:00:00','User Account Updated',3,'Account',1,NULL,NULL,'',1,'2012-06-09 13:56:24');

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find the position of a string and replace with another string

Hi, I have a file named "Test_2008_01_21" The file contains a string "manual" that occurs many times in the file How can i find the positions of the string "manual" in the file Ex: if the string " manual " occurs three times in the file. i want to replace the second occurance of string... (6 Replies)
Discussion started by: bab123
6 Replies

2. Shell Programming and Scripting

Search for a string and replace the searched string in the same position

Hi All, My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found..The issue is the last... (15 Replies)
Discussion started by: ganesh_248
15 Replies

3. UNIX for Dummies Questions & Answers

Search for a string and replace the searched string in the same position in samefile

Hi All, My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found in the same file..The... (27 Replies)
Discussion started by: ganesh_248
27 Replies

4. Shell Programming and Scripting

Using sed to replace a string in file with a string in a variable that contains spaces

Hi, i call my shell like: my_shell "my project name" my script: #!/bin/bash -vx projectname=$1 sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp cp temp test_config_doxy the following error occurres: sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies

5. UNIX for Dummies Questions & Answers

Search a string in the file and then replace another string after that position

Hi I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall: E.g: Actual File content: Hello Name: Nitin Raj Welcome to Unix... (4 Replies)
Discussion started by: dashing201
4 Replies

6. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

7. Shell Programming and Scripting

Using sed to replace a string in a specific position

I asked this before, but my problem got more complicated. Heres what I am trying to do: I'm trying to replace a string at a certain location with another string. Heres the file I'm trying to change: \E I want to replace the escape code at the 3rd line, 2nd column with this escape code... (3 Replies)
Discussion started by: tinman47
3 Replies

8. Shell Programming and Scripting

Search for a string at a particular position and replace with blank based on position

Hi, I have a file with multiple lines(fixed width dat file). I want to search for '02' in the positions 45-46 and if available, in that lines, I need to replace value in position 359 with blank. As I am new to unix, I am not able to figure out how to do this. Can you please help me to achieve... (9 Replies)
Discussion started by: Pradhikshan
9 Replies

9. Shell Programming and Scripting

Replace string in XML file with awk/sed with string from another

Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file: </member> <member> <name>TransactionID</name> <value><string>123456789123456</string></value> </member> <member> <name>Number</name> ... (9 Replies)
Discussion started by: cozzin
9 Replies

10. Shell Programming and Scripting

Replace string of a file with a string of another file for matches using grep,sed,awk

I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: --> cat comp.pkglist Package list: nss-util-devel-3.28.4-1.el6_9.x86_64 Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies
ugweb(1M)																 ugweb(1M)

NAME
ugweb - starts the HP-UX User and Group Account Configuration tool SYNOPSIS
[ ] [ ] DESCRIPTION
The HP-UX User and Group Account Configuration tool ( ) is used to manage user accounts and group accounts on the local system. This tool can also be used to manage user accounts on a NIS system. The HP-UX User and Group Account Configuration tool provides both Web-based and terminal user interface. The Web-based interface is launched through the HP System Management Homepage. Superuser privileges are required to access the HP-UX User and Group Account Configuration tool. A user who does not have superuser privi- leges has read-only access to the Local Users, NIS Users and Groups areas in the HP-UX User and Group Account Configuration tool and cannot modify local user accounts, group accounts and NIS User accounts. An attempt will be made to connect to a Mozilla/Netscape Web browser running on the X server defined by the DISPLAY environment variable. If a running Mozilla/Netscape client is found, it will be used, otherwise a new Mozilla/Netscape session will be initiated. This will only happen if the Mozilla/Netscape process is running in the same system as that referenced by the DISPLAY variable, unless the -F option is used. Note: By default, the HP-UX User and Group Account Configuration tool (ugweb) invokes the Mozilla Web browser. If you want to support any other browser (Netscape), set the $BROWSER environment variable as shown below: The terminal user interface is invoked if any of the following conditions are true: o The command is invoked with the option. o The environment variable is not set. The Web-based interface is launched if all the following conditions are true: o The command is invoked with option. o The environment variable is set. o The command is available on the system. If the Web-based interface cannot be launched, invokes the terminal user interface. Options recognizes the following options: Forces a client browser to be used in less secure ways. The option forces the client browser to be used or started, even when the X-traffic between the X-server and the Mozilla browser is not secure. Use this option only when you are sure the network traffic between the host where Mozilla is running and the host in the DISPLAY variable is secure. If cannot start the Web browser, the terminal interface is started. When the HP-UX User and Group Account Configuration Web interface is invoked by SMH, the option is used. If a privileged user (root) executes the command with the option, a temporary login bypass key is generated. The bypass key enables the user to access the Web interface without having to provide login information again. When the HP-UX User and Group Account Configuration interface is started by SMH, the option is used. Launches the terminal interface for managing local users, NIS users and groups regardless of the current setting of the environment variable. You can also start the HP-UX User and Group Account Configuration tool using one of the following methods: o Run and select the Accounts for Users and Groups to launch the tool in Terminal User Interface mode o Start the HP-UX User and Group Account Configuration tool Web interface by typing the URL in the address bar of your browser, where hostname is the name of the server o Launch the HP-UX Systems Insight Manager on the server and select the User and Group Account Configuration tool from the Config- ure -> HP-UX Configuration menu Online Help After the HP-UX User and Group Account Configuration tool is started, the online help provides details on how to use the tool. RETURN VALUES
Upon completion, ugweb returns one of the following values: o 0 Successful o 1 An error occurred AUTHOR
was developed by Hewlett-Packard. ugweb(1M)
All times are GMT -4. The time now is 12:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy