Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How can I search and change an specific string in a file Post 302703775 by vidyadhar85 on Thursday 20th of September 2012 11:10:49 AM
Old 09-20-2012
try..

Code:
 
awk '{if($0~/^t/&&$4=="3"&&$5=="4"&&$NF=="-1024"){$NF="-1022";{print $0}}else{print $0}}' filename

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search a specific string

Hi, I have following requirement. Pls suggest. To search a string in a file which is combination of character and number(always 9 digit, but numeric). if found then caputure the exit return code as 0 else 1 , if 0 then next job can be triggerd. If exit code is 1, should return a failure... (10 Replies)
Discussion started by: zooby
10 Replies

2. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

3. UNIX for Dummies Questions & Answers

Search for a specific String in a log file for a specific date range

Hi, I have log file which rolls out every second which is as this. HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
Discussion started by: karthikprakash
3 Replies

4. UNIX for Dummies Questions & Answers

Need to search specific string in a log

Hi, I have a log file containing below data 12/3/14 12:43:59 AM WIT |Performance threshold: elapsed time = 3152... (5 Replies)
Discussion started by: csm231
5 Replies

5. UNIX for Dummies Questions & Answers

Search specific string logfile specific date range

Hi, I have logfile like this.. === 2014-02-09 15:46:59,936 INFO RequestContext - URL: '/eyisp/sc/skins/EY/images/pickers/comboBoxPicker_Over.png', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko': Unsupported with Accept-Encoding header === 2015-02-09... (8 Replies)
Discussion started by: kishk
8 Replies

6. Shell Programming and Scripting

Using sed to change values after a specific string

Hello I have a script that searches a file for a specific string and then changes the nth column after that string. I have searched online for how to do this with sed but have not seemed to find a solution that works for me. I am using bash. Some background info: - Currently I am using awk to... (4 Replies)
Discussion started by: prodigious8
4 Replies

7. Shell Programming and Scripting

Change some string in specific column with space

Hello All of Master Script , i need help to solve my problem before : mount /dev/rdsk/c1t69d0s6 /dev/rdsk/c1t69d0s6 /vol/cl123/PURGE1 ufs mount /dev/rdsk/c1t70d0s6 /dev/rdsk/c1t70d0s6 /vol/cl123/PURGE2 ufs expected : mount /dev/dsk/c1t69d0s6 /dev/rdsk/c1t69d0s6 /PURGE1 ufs mount ... (3 Replies)
Discussion started by: k0p0nkkk
3 Replies

8. Shell Programming and Scripting

Search a string in a file and change another in the line

I did it myself (0 Replies)
Discussion started by: apenkov
0 Replies

9. Shell Programming and Scripting

awk to change specific string to new value if found in text file

I am trying to use awk to change a specific string in a field, if it is found, to another value. In the tab-delimited file the text in bold in $3 contains the string 23, which is always right before a ., if it is present. I am trying to change that string to X, keeping the formatting and the... (3 Replies)
Discussion started by: cmccabe
3 Replies

10. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies
ARCH(1) 						    BSD General Commands Manual 						   ARCH(1)

NAME
arch -- print architecture type or run selected architecture of a universal binary SYNOPSIS
arch arch [-32] [-64] [[-arch_name | -arch arch_name]...] [-c] [-d envname]... [-e envname=value]... [-h] prog [args ...] DESCRIPTION
The arch command with no arguments, displays the machine's architecture type. The other use of the arch command it to run a selected architecture of a universal binary. A universal binary contains code that can run on different architectures. By default, the operating system will select the architecture that most closely matches the processor type. This means that an intel architecture is selected on intel processors and a powerpc architecture is selected on powerpc processors. A 64-bit architecture is preferred over a 32-bit architecture on a 64-bit processor, while only 32-bit architectures can run on a 32-bit processor. When the most natural architecture is unavailable, the operating system will try to pick another architecture. On 64-bit processors, a 32-bit architecture is tried. If this is also unavailable, the operating system on an intel processor will try running a 32-bit powerpc architecture. Otherwise, no architecture is run, and an error results. The arch command can be used to alter the operating system's normal selection order. The most common use is to select the 32-bit architec- ture on a 64-bit processor, even if a 64-bit architecture is available. The arch_name argument must be one of the currently supported architectures: i386 32-bit intel x86_64 64-bit intel Either prefix the architecture with a hyphen, or (for compatibility with other commands), use -arch followed by the architecture. If more than one architecture is specified, the operating system will try each one in order, skipping an architecture that is not supported on the current processor, or is unavailable in the universal binary. The other options are: -32 Add the native 32-bit architecture to the list of architectures. -64 Add the native 64-bit architecture to the list of architectures. -c Clears the environment that will be passed to the command to be run. -d envname Deletes the named environment variable from the environment that will be passed to the command to be run. -e envname=value Assigns the given value to the named environment variable in the environment that will be passed to the command to be run. Any existing environment variable with the same name will be replaced. -h Prints a usage message and exits. The prog argument is the command to run, followed by any arguments to pass to the command. It can be a full or partial path, while a lone name will be looked up in the user's command search path. If no architectures are specified on the command line, the arch command takes the basename of the prog argument and searches for the first property list file with that basename and the .plist suffix, in the archSettings sub-directory in each of the standard domains, in the fol- lowing order: ~/Library/archSettings User settings /Library/archSettings Local settings /Network/Library/archSettings Network settings /System/Library/archSettings System settings This property list contains the architecture order preferences, as well as the full path to the real executable. For examples of the prop- erty list format, look at the files in /System/Library/archSettings. Example On an intel processor: % perl -MConfig -e 'printf "%s ", $Config{byteorder}' 1234 shows the intel little endian byte order. Making links to the arch command When a link is made to arch command with a different name, that name is used to find the corresponding property list file. Thus, other com- mands can be wrapped so that they have custom architecture selection order. Because of some internal logic in the code, hard links to the arch command may not work quite right. It is best to avoid using hard links, and only use symbolic links to the arch command. Environment The environment variable ARCHPREFERENCE can be used to provide architecture order preferences. It is checked before looking for the corre- sponding property list file. The value of the environment variable ARCHPREFERENCE is composed of one or more specifiers, separated by semicolons. A specifier is made up of one, two or three fields, separated by colons. Architectures specified in order, are separated by commas and make up the last (mandatory) field. The first field, if specified, is a name of a program, which selects this specifier if that name matches the program name in ques- tion. If the name field is empty or there is no name field, the specifier matches any program name. Thus, ordering of specifiers is impor- tant, and the one with no name should be last. When the arch command is called directly, the prog name provides the path information to the executable (possibly via the command search path). When a name is specified in a ARCHPREFERENCE specifier, the path information can alternately be specified as a second field following the name. When the arch command is called indirectly via a link, this path information must be specified. If not specified as a second field in a specifier, the executable path will be looked up in the corresponding property list file. Example ARCHPREFERENCE Values i386,x86_64 A specifier that matches any name. foo:i386,x86_64 A specifier that matches the program named foo (the full executable path is in the foo.plist file). foo:/op/bin/boo:i386,x86_64 A specifier with all fields specified. baz:i386;x86_64 A specifier for baz and a second specifier that would match any other name. BUGS
Running the arch command on an interpreter script may not work if the interpreter is a link to the arch command, especially if a 64-bit architecture is specified (since the arch command is 2-way universal, 32-bit only). SEE ALSO
machine(1) Mac OS X July 8, 2010 Mac OS X
All times are GMT -4. The time now is 12:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy