Sponsored Content
Top Forums Shell Programming and Scripting Find string in file and append new string after Post 302859307 by Smiling Dragon on Wednesday 2nd of October 2013 06:18:55 PM
Old 10-02-2013
Code:
sed -e 's/\(parent::__construct();\)/\1\nNEW STRING/'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search a string and append text after the string

Hi, I have a file like this... <o t="Batch" id="8410" p="/" g="32"> <a n="name"> <v s="DBBA1MM"/> </a> <a n="owner"> <v r="/Administrator"/> </a> <a n="rights"> <v s="95"/> </a> <a n="debugLevel"> <v s="3"/> </a> <a n="avsStoreLoc"> <v... (8 Replies)
Discussion started by: kesu2k
8 Replies

2. UNIX for Dummies Questions & Answers

How can i append a file name with a string

Hi All How can i append a file name with a string e.g. Lets say i have a file called ABC_TEST_1234_1.dat and i want to append the file name with a lets say 100 so the output file should look like ABC_100_TEST_1234_1.dat i have aroung 9000 file in a directory and want to... (3 Replies)
Discussion started by: Nikhilindurkar
3 Replies

3. Shell Programming and Scripting

sed to find first appearance and append string

I have a file like below #GROUP A belongs to Asia GROUP A jojh hans local admin GROUP A gege fans michel jing jong #GROUP U belongs to USA GROUP U jeff goal hello world My requirement is to grep for first apperence of GROUP A which is not commented and append my name to end of file.... (12 Replies)
Discussion started by: vkk
12 Replies

4. Linux

Find String in FileName and move the String to new File if not found

Hi all, I have a question.. Here is my requirement..I have 500 files in a path say /a/b/c I have some numbers in a file which are comma seperated...and I wanted to check if the numbers are present in the FileName in the path /a/b/c..if the number is there in the file that is fine..but if... (1 Reply)
Discussion started by: us_pokiri
1 Replies

5. UNIX for Dummies Questions & Answers

Append a string on the next line after a pattern string is found

Right now, my code is: s/Secondary Ins./Secondary Ins.\ 1/g It's adding a 1 as soon as it finds Secondary Ins. Primary Ins.: MEDICARE B DMERC Secondary Ins. 1: CONTINENTAL LIFE INS What I really want to achieve is having a 1 added on the next line that contain "Secondary Ins." It... (4 Replies)
Discussion started by: newbeee
4 Replies

6. Shell Programming and Scripting

find string and replace with string in other file

Dear all, I need your help, I have file like this: file1:23456 01910964830098775635 34567 01942809546554654323 67589 26546854368698023653 09778 58716868568576876878 08675 86178546154065406546 08573 54165843543054354305 . .file2: 23456 25 34567 26 67589 27 (2 Replies)
Discussion started by: attila
2 Replies

7. Shell Programming and Scripting

Find string in a file and append character

Hi Experts, Is there a way to find a string in a file then append a character to that string then save the file or save to another file. Here is an example. >cat test.txt NULL NULL NULL 9,800.00 NULL 1,234,567.01 I want to find all NON NULL String and add a dollar sign to those... (9 Replies)
Discussion started by: brichigo
9 Replies

8. Shell Programming and Scripting

Append a searched string with another string using sed

Hi, I need to replace and append a string in a text if grep is true. For eg: grep ABC test.txt | grep -v '\.$' | awk {'print $4'} | sed "s/ ? How do I replace all instances of "print $4" using sed with another sring? Eg of the string returned will be, lx123 web222 xyz Want to... (8 Replies)
Discussion started by: vchee
8 Replies

9. Shell Programming and Scripting

sed - Find a String and append a text end of the Line

Hi, I have a File, which have multiple rows. Like below 123456 Test1 FNAME JRW#$% PB MO Approver XXXXXX. YYYY 123457 Test2 FNAME JRW#$% PB MO Super XXXXXX. YYYY 123458 Test3 FNAME JRW#$% PB MO Approver XXXXXX. YYYY I want to search a line which contains PB MO Approver and append... (2 Replies)
Discussion started by: java2006
2 Replies

10. Shell Programming and Scripting

Find string in file and find the all records by string

Hello I would like to get know how to do this: I got a big file (about 1GB) and I need to find a string (for instance by grep ) and then find all records in this file based on a string. Thanks for advice. Martin (12 Replies)
Discussion started by: mape
12 Replies
STR_PAD(3)								 1								STR_PAD(3)

str_pad - Pad a string to a certain length with another string

SYNOPSIS
string str_pad (string $input, int $pad_length, [string $pad_string = " "], [int $pad_type = STR_PAD_RIGHT]) DESCRIPTION
This functions returns the $input string padded on the left, the right, or both sides to the specified padding length. If the optional argument $pad_string is not supplied, the $input is padded with spaces, otherwise it is padded with characters from $pad_string up to the limit. PARAMETERS
o $input - The input string. o $pad_length - If the value of $pad_length is negative, less than, or equal to the length of the input string, no padding takes place. o $pad_string - Note The $pad_string may be truncated if the required number of padding characters can't be evenly divided by the $pad_string's length. o $pad_type - Optional argument $pad_type can be STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. If $pad_type is not specified it is assumed to be STR_PAD_RIGHT. RETURN VALUES
Returns the padded string. EXAMPLES
Example #1 str_pad(3) example <?php $input = "Alien"; echo str_pad($input, 10); // produces "Alien " echo str_pad($input, 10, "-=", STR_PAD_LEFT); // produces "-=-=-Alien" echo str_pad($input, 10, "_", STR_PAD_BOTH); // produces "__Alien___" echo str_pad($input, 6 , "___"); // produces "Alien_" ?> PHP Documentation Group STR_PAD(3)
All times are GMT -4. The time now is 02:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy