Sponsored Content
Full Discussion: Pattern matching sed
Top Forums Shell Programming and Scripting Pattern matching sed Post 67397 by Ygor on Wednesday 23rd of March 2005 03:06:02 AM
Old 03-23-2005
Perhaps use printf...
Code:
MSG="THERE WERE %s RECORDS IN ERROR TABLE,%s, WHEN LOADING THE %s TABLE WITH EXTRACT FROM %s INTO TABLES, FOR DATABASE %s.\\n"
printf "$MSG" $record $errortbl $mptbl $sysname $dbname

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed pattern matching

Hi, I have a file which contains a word like ravi and ravi30. i want to replace only the word ravi with xxx for that i am using the below sed command sed -e 's/ravi/xxx/g' . but the above command out put is xxx and xxx30 but i dont need to change ravi30 please guide me how to proceed.... (4 Replies)
Discussion started by: ravi_rn
4 Replies

2. Shell Programming and Scripting

sed - matching pattern one but not pattern two

All, I have the following file: -------------------------------------- # # /etc/pam.d/common-password - password-related modules common to all services # # This file is included from other service-specific PAM config files, # and should contain a list of modules that define the services... (2 Replies)
Discussion started by: RobertBerrie
2 Replies

3. Shell Programming and Scripting

sed pattern matching

Hi all, if I have the following piece (repeating) of text within a file and I wish to delete it via sed a b c d e <tr> <td><img alt="" height="1" width="3" src="/testweb/view/browser/images/shim.gif"></td><td><img alt="" height="1" ... (4 Replies)
Discussion started by: srage
4 Replies

4. Shell Programming and Scripting

sed pattern matching

Unfortunately this chap has been banned for some reason and I was looking forward to the resolution of his question: - https://www.unix.com/shell-programming-scripting/123118-append-position-28-33-a.html He was asking if you can use sed to match a pattern you want to replace within a... (6 Replies)
Discussion started by: steadyonabix
6 Replies

5. Shell Programming and Scripting

SED pattern matching help

Hello All, I have the following lines in a file <address location="test" ConnectionName="test" /> I want to replace the above lines by <address location="test123" /> I am usind SED and not able to remove the new line characters between the two lines. Can anyone please help... (4 Replies)
Discussion started by: ramk
4 Replies

6. Shell Programming and Scripting

help! Pattern Matching in vi or sed

I have a bunch of conf files, that contain the fully qualified names of servers. I would like to be able to use some sort of pattern matching with sed or vi, or whatever, to pull out the fully qualified server names, and dump them in a file. It just needs to work across several unix os. So, I... (4 Replies)
Discussion started by: tabini
4 Replies

7. Shell Programming and Scripting

Help with sed pattern matching

Hi My log file is Testtmp2 cat Testtmp2 12:12:38 12:14:29 12:17:34 12:19:08 12:20:10 12:21:35 12:22:20 12:22:26 12:22:34 12:22:38 12:28:14 12:31:35 12:32:50 12:33:04 (3 Replies)
Discussion started by: rahkumar
3 Replies

8. UNIX for Dummies Questions & Answers

sed print matching pattern

Hi, i have data file like: START1 a b STOP c d START2 e STOP f START3 g STOP When one of the START<count> variable is passed, i should print all lines matching this until the first 'STOP' for example if 'START2' is provided for match, i should get the result as: START2 (1 Reply)
Discussion started by: ysrini
1 Replies

9. Shell Programming and Scripting

Sed: printing lines AFTER pattern matching EXCLUDING the line containing the pattern

'Hi I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match. Which option is to be used to exclude the line containing the pattern? sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies

10. Shell Programming and Scripting

Use sed to get first matching pattern

HI, I have a file: listenerport: - 1521 - 10520 - 10521 - 10522 - 10523 instances: listenerport: listenerport: - 1521 - 10540 - 10541 - 10542 - 10543 instances: ... (5 Replies)
Discussion started by: netbanker
5 Replies
fold(1) 						      General Commands Manual							   fold(1)

NAME
fold - Breaks or wraps lines in a file SYNOPSIS
fold [-bs] [-w width | -width] [file...] The fold command wraps lines in the specified files. If a file is not specified, standard input is the default. All lines are wrapped to meet the maximum width specified. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: fold: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Specifies that width be counted in bytes rather than in column positions. Using the -b option does not limit lines to LINE_MAX bytes. Breaks (or wraps) a line if a segment of the line contains a blank character in the first width column position (or bytes). This enables the line to meet width constraints. If a blank character is not in the correct width column position, the -s option has no affect on that input line. Specifies the maximum width to use when lines are wrapped in column positions (or bytes if the -b option is specified). Either -w width or -width is acceptable input where width is the number of column positions (or bytes). The default value is 80. DESCRIPTION
The fold command is a filter that wraps lines from the specified input files or standard input to a maximum of width (or bytes, if the -b option is specified). The fold command wraps lines by inserting a newline character into the output so that each output line is the maxi- mum column positions or bytes specified. A line cannot be broken in the middle of a character. The fold command is often used to send text files to line printers that truncate, rather than wrap, lines wider than the printer is able to print (usually 80 or 132 column positions). If the <backspace>, <tab>, or <carriage return> characters are encountered in the input, and the -b option is not specified, these charac- ters are treated specially: The current count of line width is decremented by one, although the count never becomes negative. The fold command does not insert a newline character immediately before or after any backspace character. Each tab character encountered advances the column position pointer to the position of the next tab stop. Tab stops are at each column position number, such that number modulo 8 equals 1. The current count of the line width is set to zero (0). The fold command does not insert a newline immediately before or after any carriage return. [Tru64 UNIX] The fold command possibly affects underlining in a file. EXIT STATUS
The fold command returns the following values: All input files were successfully processed. [Tru64 UNIX] A usage error occurred. [Tru64 UNIX] An input file cannot be opened. The fold command continues processing the other input files specified on the command line. EXAMPLES
The fold command can be used to prepare files to be joined side-by-side with the paste command. For example, the contents of two files, az and AZ follows: aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO PPPP QQQQ RRRR SSSS TTTT UUUU VVVV WWWW XXXX YYYY ZZZZ To display the az and AZ files side-by-side, use the following command line: fold -w 32 az > az2; fold -w 32 AZ > AZ2; paste -d" " az2 AZ2 Executing the previous command line results in the following output: aaaa bbbb cccc dddd eeee ffff gg AAAA BBBB CCCC DDDD EEEE FFFF GG gg hhhh iiii jjjj kkkk llll mmmm GG HHHH IIII JJJJ KKKK LLLL MMMM nnnn oooo pppp qqqq rrrr ssss tt NNNN OOOO PPPP QQQQ RRRR SSSS TT tt uuuu vvvv wwww xxxx yyyy zzzz TT UUUU VVVV WWWW XXXX YYYY ZZZZ ENVIRONMENT VARIABLES
The following environment variables affect the execution of fold: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments) and for the determination of the width in column positions each character would occupy on a constant-width font output device. Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MES- SAGES. SEE ALSO
Commands: cut(1), expand(1), paste(1) Standards: standards(5) fold(1)
All times are GMT -4. The time now is 07:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy