Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Conditionally replace field content Post 302960300 by RudiC on Friday 13th of November 2015 08:52:18 AM
Old 11-13-2015
WHAT exactly is the problem (except from you specifying the field separator twice)? I found it working trying it on some sample file...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

change field content awk

I have a line like this: I want to move HTTP/1.1 200 OK to the next line and put a blank line between the two lines i.e. How can i get it using awk? Thanks in advance (2 Replies)
Discussion started by: littleboyblu
2 Replies

2. Shell Programming and Scripting

how to spilit a row into fields and store the field content to the array

consider this is a line A#B#C#D#E#F#G#H note the delimeter is # i want to cut or spilt in to fields using the delimeter # and to store in an array. like this array=A array=B array=C array=D array=E and the array content should be displayed. echo "${array}" echo "${array}"... (5 Replies)
Discussion started by: barani75
5 Replies

3. Shell Programming and Scripting

replace blank field in file 2 with content of file 1

Something like vlookup in excel, column 2 in file 2 is blank and should be replaced by column 2 in file 1 based on comparing column 1 in both files. file1 Code: 1234~abc~b~c~d~e~f~g~h~09/10/09 5678~def~b~c~d~e~f~g~h~12/06/10 8910~hij~b~c~d~e~f~g~h~03/28/13... (1 Reply)
Discussion started by: sigh2010
1 Replies

4. Shell Programming and Scripting

How to replace a text in a file conditionally?

I have got about 100 ascii files and I want replace some variable with a new one on an HP-UX system. But I want to put a line of comments before the change. I want to make file1 to file2. I am explaining below. file1: line1 line2 export QNAME=ABC line4 line5 file2: line1 line2 #... (3 Replies)
Discussion started by: asutoshch
3 Replies

5. Shell Programming and Scripting

sed to replace a field from a line with another field

i have something like this, cat filename.txt hui this si s"dfgdfg" omeone ipaddress="10.19.123.104" wel hope this works i want to replace only 10.19.123.104 with different ip say 10.19.123.103 i tried this sed -i "s/'ipaddress'/'ipaddress=10.19.123.103'/g" filename.txt ... (1 Reply)
Discussion started by: vivek d r
1 Replies

6. UNIX for Dummies Questions & Answers

How to conditionally replace a pattern?

Hi, How to replace only the function calls with a new name and skip the function definition and declarations. consider the following code. There are 2 functions defined here returnint and returnvoid. I need to replace returnint with giveint and returnvoid with givevoid only in the function... (1 Reply)
Discussion started by: i.srini89
1 Replies

7. Shell Programming and Scripting

How to conditionally replace a pattern?

Hi, How to replace only the function calls with a new name and skip the function definition and declarations. consider the following code. There are 2 functions defined here returnint and returnvoid. I need to replace returnint with giveint and returnvoid with givevoid only in the function... (2 Replies)
Discussion started by: i.srini89
2 Replies

8. Shell Programming and Scripting

Replace a field with a character as per the field length

Hi all, I have a requirement to replace a field with a character as per the length of the field. Suppose i have a file where second field is of 20 character length. I want to replace second field with 20 stars (*). like ******************** As the field is not a fixed one, i want to do the... (2 Replies)
Discussion started by: gani_85
2 Replies

9. Shell Programming and Scripting

Conditionally replace nth argument of every function call

I have very large perl source code file and I want to replace every occurrence function say foo,The function foo has some arguments and I want to replace 2nd argument,the current argument is hex integer and i want to replace it to equivalent string.Also I want to replace function name foo with... (4 Replies)
Discussion started by: pravint
4 Replies

10. Shell Programming and Scripting

Need to replace last field in a file,if first field matches

Hi, Need to replace last field in a file(/etc/passwd) ,if first filed matches with particular username. Scenario: cat testfor1 deekshi:x:7082:7082::/home/deekshi:/bin/bash harini1:x:7083:7083::/home/harini1:/bin/bash Here,if first field contains "deekshi", then i should replace... (4 Replies)
Discussion started by: Sumanthsv
4 Replies
GIT-REPLACE(1)							    Git Manual							    GIT-REPLACE(1)

NAME
       git-replace - Create, list, delete refs to replace objects

SYNOPSIS
       git replace [-f] <object> <replacement>
       git replace [-f] --edit <object>
       git replace [-f] --graft <commit> [<parent>...]
       git replace -d <object>...
       git replace [--format=<format>] [-l [<pattern>]]

DESCRIPTION
       Adds a replace reference in refs/replace/ namespace.

       The name of the replace reference is the SHA-1 of the object that is replaced. The content of the replace reference is the SHA-1 of the
       replacement object.

       The replaced object and the replacement object must be of the same type. This restriction can be bypassed using -f.

       Unless -f is given, the replace reference must not yet exist.

       There is no other restriction on the replaced and replacement objects. Merge commits can be replaced by non-merge commits and vice versa.

       Replacement references will be used by default by all Git commands except those doing reachability traversal (prune, pack transfer and
       fsck).

       It is possible to disable use of replacement references for any command using the --no-replace-objects option just after git.

       For example if commit foo has been replaced by commit bar:

	   $ git --no-replace-objects cat-file commit foo

       shows information about commit foo, while:

	   $ git cat-file commit foo

       shows information about commit bar.

       The GIT_NO_REPLACE_OBJECTS environment variable can be set to achieve the same effect as the --no-replace-objects option.

OPTIONS
       -f, --force
	   If an existing replace ref for the same object exists, it will be overwritten (instead of failing).

       -d, --delete
	   Delete existing replace refs for the given objects.

       --edit <object>
	   Edit an object's content interactively. The existing content for <object> is pretty-printed into a temporary file, an editor is
	   launched on the file, and the result is parsed to create a new object of the same type as <object>. A replacement ref is then created
	   to replace <object> with the newly created object. See git-var(1) for details about how the editor will be chosen.

       --raw
	   When editing, provide the raw object contents rather than pretty-printed ones. Currently this only affects trees, which will be shown
	   in their binary form. This is harder to work with, but can help when repairing a tree that is so corrupted it cannot be pretty-printed.
	   Note that you may need to configure your editor to cleanly read and write binary data.

       --graft <commit> [<parent>...]
	   Create a graft commit. A new commit is created with the same content as <commit> except that its parents will be [<parent>...] instead
	   of <commit>'s parents. A replacement ref is then created to replace <commit> with the newly created commit. See
	   contrib/convert-grafts-to-replace-refs.sh for an example script based on this option that can convert grafts to replace refs.

       -l <pattern>, --list <pattern>
	   List replace refs for objects that match the given pattern (or all if no pattern is given). Typing "git replace" without arguments,
	   also lists all replace refs.

       --format=<format>
	   When listing, use the specified <format>, which can be one of short, medium and long. When omitted, the format defaults to short.

FORMATS
       The following format are available:

       o   short: <replaced sha1>

       o   medium: <replaced sha1> -> <replacement sha1>

       o   long: <replaced sha1> (<replaced type>) -> <replacement sha1> (<replacement type>)

CREATING REPLACEMENT OBJECTS
       git-filter-branch(1), git-hash-object(1) and git-rebase(1), among other git commands, can be used to create replacement objects from
       existing objects. The --edit option can also be used with git replace to create a replacement object by editing an existing object.

       If you want to replace many blobs, trees or commits that are part of a string of commits, you may just want to create a replacement string
       of commits and then only replace the commit at the tip of the target string of commits with the commit at the tip of the replacement string
       of commits.

BUGS
       Comparing blobs or trees that have been replaced with those that replace them will not work properly. And using git reset --hard to go back
       to a replaced commit will move the branch to the replacement commit instead of the replaced commit.

       There may be other problems when using git rev-list related to pending objects.

SEE ALSO
       git-hash-object(1) git-filter-branch(1) git-rebase(1) git-tag(1) git-branch(1) git-commit(1) git-var(1) git(1)

GIT
       Part of the git(1) suite

Git 2.17.1							    10/05/2018							    GIT-REPLACE(1)
All times are GMT -4. The time now is 01:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy