Sponsored Content
Top Forums Shell Programming and Scripting Read from one file-Replace a pattern in another with the current one Post 302740135 by bartus11 on Wednesday 5th of December 2012 03:34:57 PM
Old 12-05-2012
Try:
Code:
awk 'NR==FNR{a[++n]=$0;next}{for (i=1;i<=n;i++){x=a[i];gsub ("website",$0,x);print x > "main"FNR".txt"}}' main.txt replace.txt

This User Gave Thanks to bartus11 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read file and print additional rows till current year

Hi all i have a file like 2006,1,2 2007,2,3 2008,3,4 I will read this and my output should be like 2006,1,2 2007,1,2 2008,1,2 2007,2,3 2008,2,3 2008,3,4 Giving the explanation, we will read the first line of the file and if the year any other than current year, we will print as many... (1 Reply)
Discussion started by: vasuarjula
1 Replies

2. Shell Programming and Scripting

read from a specific pattern from one file and append it to another

Hi! Everyone, Say this file1 -------------- line 1 51610183 420001010 0010CTCTLEDPPOO 2151610183 line 2 2151610183 420001010 0030A2TH2 line 3 2151610183 420001010 0040A2TH3 line 4 2151610183 420001010 ... (0 Replies)
Discussion started by: kinkar_ghosh
0 Replies

3. Shell Programming and Scripting

Replace a particular pattern in a file

Hi , I have a requirement where i have this file abcd $$xyz=123 $$zef=789 $$mno=123 $$pqr=456 I need to replace $$pqr from 456 to a new value which will be present in a variable to me. I am not aware of sed and awk functionality. Can somebody please show me how to replace this... (6 Replies)
Discussion started by: lifzgud
6 Replies

4. Shell Programming and Scripting

Read file and for each line replace two variables, add strings and save output in another file

Hi All, I have a file, let's call it "info.tmp" that contains data like this .. ABC123456 PCX333445 BCD789833 I need to read "info.tmp" and for each line add strings in a way that the final output is put /logs/ua/dummy.trigger 'AAA00001.FTP.XXX.BLA03A01.xxxxxx(+1)' where XXX... (5 Replies)
Discussion started by: Andy_ARG
5 Replies

5. UNIX for Dummies Questions & Answers

find the file names having specified pattern at specified position in the current directory

I would need a command for finding first 15000 of the file names whose 25th postion is 5 in the current directory alone. I do have this painful command find . -name '5*' | head -15000 | cut -c3- please refine this. Of course the above command also searches in the sub directories... (3 Replies)
Discussion started by: vk39221
3 Replies

6. Shell Programming and Scripting

Finding 4 current files having specific File Name pattern

Hi All, I am trying to find 4 latest files inside one folder having following File Name pattern and store them into 4 different variables and then use for processing in my shell script. File name is fixed length. 1) Each file starts with = ABCJmdmfbsjop letters + 7 Digit Number... (6 Replies)
Discussion started by: lancesunny
6 Replies

7. Shell Programming and Scripting

awk - writing matching pattern to a new file and deleting it from the current file

Hello , I have comma delimited file with over 20 fileds that i need to do some validations on. I have to check if certain fields are null and then write the line containing the null field into a new file and then delete the line from the current file. Can someone tell me how i could go... (2 Replies)
Discussion started by: goddevil
2 Replies

8. Shell Programming and Scripting

Help with ksh-to read ip file & append lines to another file based on pattern match

Hi, I need help with this- input.txt : L B white X Y white A B brown M Y black Read this input file and if 3rd column is "white", then add specific lines to another file insert.txt. If 3rd column is brown, add different set of lines to insert.txt, and so on. For example, the given... (6 Replies)
Discussion started by: prashob123
6 Replies

9. Shell Programming and Scripting

Perl script to read string from file#1 and find/replace in file#2

Hello Forum. I have a file called abc.sed with the following commands; s/1/one/g s/2/two/g ... I also have a second file called abc.dat and would like to substitute all occurrences of "1 with one", "2 with two", etc and create a new file called abc_new.dat sed -f abc.sed abc.dat >... (10 Replies)
Discussion started by: pchang
10 Replies

10. Shell Programming and Scripting

Script to replace a string with pattern read from a file

I have two files blocks.txt and rules.txt. In blocks.txt i have the following entries Linux1 Linux2 Linux3 ..... Linux10 In rules.txt i have the lines where a filename pattern starts like 'blk-name.*' I want to replace 'blk-name' with the names read from blocks.txt file I tried... (2 Replies)
Discussion started by: Jag02
2 Replies
coreadm(1M)															       coreadm(1M)

NAME
coreadm - core file administration SYNOPSIS
pattern] pattern] option] option] [pid...] [pid...] [arguments] [pid...] DESCRIPTION
The command is used for user space application core file management by specifying the name and the location of core files for abnormally terminating processes. See core(4). The command can be used to control system wide and process specific core file placement. The path and pattern is used by the operating system when generating a core file. The first form shown in can be used to control system wide core file settings or specify a pattern for init(1M). System administration privilege is required to change global core file settings. Global core file setting, including the setting for init(1M), is preserved across system reboot. Non-privileged users can change per-process core file settings for processes owned by that user. The real or the effective user ID of the calling process must match the real or the saved user ID of the receiving process unless the effective user ID of the calling process is a user who as appropriate privileges. A core file name pattern is a normal file system path name with embedded variables, specified with a leading character, that are expanded from values in effect when a core file is generated by the operating system. An expanded pattern over will be truncated to The possible pattern variables are: Options The following options are supported for Disable or enable the specified core file option. The and options can only be exercised with root privilege. The valid options for and are: Allow (or disallow) core dumps using the global core pattern. Allow (or disallow) core dumps using the per-process core pattern. Allow (or disallow) core dumps using the global core pattern for processes. Allow (or disallow) core dumps using the process core pattern for processes. Set the global core file name pattern to pattern. The pattern must start with an absolute path name which exists and can contain any of the special % variables described in the section. This option can only be exercised by the super-user. This is identical to specifying a per-process pattern only that the setting is applied to init(1M) and is preserved across reboot. Set the per-process core file name pattern to pattern for each of the specified process-ID's. The pattern can contain any of the special variables described in and need not begin with If it does not begin with the core file name will be evaluated relative to the current working directory at the time of core file creation. This option can be used by non-privileged users to specify core file settings for processes owned by that user. Super-users can apply it to any process. The per-process core file will be inherited by the future child processes of the affected pro- cesses. See fork(2). This option, when invoked without a PID will apply the settings to the calling process (usually the invoking shell). This option is used in conjunction with The option will execute the command specified with the per-process pattern that was specified with This option can be used to enable or disable core file creation for the target process. As an example, a user may choose to add the disable in the shell startup script to avoid creation of core files by that user. EXAMPLES
The following examples assume that the user has appropriate privilege. 1. To examine the current core file settings: $ coreadm global core file pattern: init(1M) core file pattern: global core dumps: disabled per-process core dumps: enabled global setid core dumps: disabled per-process setid core dumps: disabled 2. Set global core file settings to include process-ID and machine name and place the core file in the location $ coreadm -e global -g /mnt/cores/core.%p.%n A process with PID 1777 on the machine breaker will generate a core file in as (in addition to the core file generated in the CWD of PID 1777). 3. Examine the per process core file settings for process-IDs 1777 and 1778 $ coreadm 1777 1778 1777: core.%p.%u 1778: /nethome/gandalf/core/core.%f.%p.%t 4. A user can disable creation of core files completely by specifying in the shell startup file (for example, $ coreadm -P disable $$ $ coreadm $$ 1157: (Disabled) WARNINGS
The output format of may change without notice. Applications parsing the output, should not rely on the compatibility of the output format between releases. SEE ALSO
umask(1), init(1M), coreadm(2), core(4). coreadm(1M)
All times are GMT -4. The time now is 01:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy