Sponsored Content
Top Forums Shell Programming and Scripting How to catch a two word keyword which may contain a new line(may include spaces or tab) in it? Post 302722309 by Yoda on Friday 26th of October 2012 05:44:20 PM
Old 10-26-2012
Code:
egrep "\([[:space:]]*select|select$" a.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to include PDF file with spaces

I am able to include a pdf file as an attachment in an email using the following: echo "" > reports elm -s "RW100 PDF Reports" me@myemail.com < reports However, if I have a filename that contains some spaces, I'm not so lucky. I've tried: echo "" > reports but no luck. I keep getting... (1 Reply)
Discussion started by: lawadm1
1 Replies

2. Shell Programming and Scripting

Replace only if the keyword is the first word in every line

How do I replace only if the keyword is at the begining of a line? Code: -- a = “This is a print statement” print a -- What if I want to replace print by #print only in the second line i.e only if the line starts with that keyword. Please help me out. I'm new to SED. -----Post... (5 Replies)
Discussion started by: alexzubin
5 Replies

3. Shell Programming and Scripting

Replace spaces between strings in a line with tab

Hi All I am having problem in substitution of any number of spaces, or a combination of space and tab in between strings in the lines of text file. Is there any way out in Perl? Please help me. e.g., Say the input is in the following format:- XX yyy zzz... (1 Reply)
Discussion started by: my_Perl
1 Replies

4. Shell Programming and Scripting

Removing blank spaces, tab spaces from file

Hello All, I am trying to remove all tabspaces and all blankspaces from my file using sed & awk, but not getting proper code. Please help me out. My file is like this (<b> means one blank space, <t> means one tab space)- $ cat file NARESH<b><b><b>KUMAR<t><t>PRADHAN... (3 Replies)
Discussion started by: NARESH1302
3 Replies

5. Shell Programming and Scripting

Include white spaces while using CUT command

Hi I tried to extract 19 characters (default) enclosed with in tag from a file using cut command. If the characters comprises of double space, the cut command gives the output with a single spacing. file 1 <name>Kumar Rajasekaran</name> cut -c7-26 "file1" the out put i received is ... (48 Replies)
Discussion started by: Sekar1
48 Replies

6. Shell Programming and Scripting

catch a particular word from a specific line -perlscript

Hi, App.log contains the data- ================================================= Value of DsRef =null Recovery File exixts Recovered readFile 20110509 17:00:00.369019 +0100s The DsRef Recovered from Recovery.txt file : 20110509 17:00:00.369019 +0100 Recovered from Recovery.txt file... (2 Replies)
Discussion started by: pspriyanka
2 Replies

7. Shell Programming and Scripting

How to get the next word which falls just after a keyword?

Hi friends, i just want to know the command though which i can get the next word which comes just after a particluar keyword. For example: suppose text.out is file which contains a pl/sql procedure . i want to find out the word which falls just after the "table1" keyword. Thank... (7 Replies)
Discussion started by: neelmani
7 Replies

8. Shell Programming and Scripting

Search for a Keyword in file and replace another keyword or add at the end of line

Hi I want to implement something like this: if( keyword1 exists) then check if(keyword2 exists in the same line) then replace keyword 2 with New_Keyword else Add New_Keyword at the end of line end if eg: Check for Keyword JUNGLE and add/replace... (7 Replies)
Discussion started by: dashing201
7 Replies

9. Shell Programming and Scripting

Removing tab spaces at the end of each line

I have a file which contains the data lines like below.I want to remove the tab spaces at the end of each line.I have tried with the command sed 's/\+$//' file.but it does not work.Can anyone help me on this? 15022 15022 15022 15022 15022 15022 15023 15023 15023 15023 15023 ... (16 Replies)
Discussion started by: am24
16 Replies

10. Shell Programming and Scripting

Need to extract the word after a particular keyword throughout the file..

Hi Everyone, Need help in extracting the hostname from the below output. Expected output: DS-TESTB-GDS-1.TEST.ABC.COM DS-TESTB-GDS-2.TEST.ABC.COM .... ... /tmp $ cat -n /tmp/patchreport 1 /usr/bin/perl /admin/bin/patch/applyPatches.pl --apply_patches... (4 Replies)
Discussion started by: thiyagoo
4 Replies
expand(1)						      General Commands Manual							 expand(1)

NAME
expand, unexpand - Replaces tab characters with spaces or spaces with tab characters SYNOPSIS
Current syntax expand [-t tablist] [file...] unexpand [-a | -t tablist] [file...] Obsolescent syntax expand [-tabstop | -tab1,tab2,...,tabn] [file...] STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: expand: XCU5.0 unexpand: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Replaces spaces at the beginning of each line with a tab, and inserts tab characters wherever their presence compresses the resultant file by replacing two or more characters. When the -t option is specified with the unexpand command, the -a option has no effect. (This option applies to the unexpand command only.) Specifies the tab stops. The tablist argument consists of a single positive decimal integer or multiple positive decimal integers, separated by spaces or commas, in ascending order. If a single number is specified, tabs are set tab- list column positions apart instead of the default (8). If multiple numbers are specified, tabs are set at those specific column posi- tions. Tabbing to tab stop position n thus causes the next character output to be in the (n+1)th column position on that line. If expand has to process a tab character at a position beyond the last of those specified in a multiple tab stop list, the tab char- acter is replaced by a single space in the output. Sets tab stops tabstop spaces apart instead of the default (8). (Obsolescent) Sets tab stops at specified columns. (Obsolescent) [Tru64 UNIX] Columns are measured in bytes. OPERANDS
The path name of a file to be processed. If you do not specify this operand, standard input is read. DESCRIPTION
The expand command changes tab characters to spaces in the named files, or the standard input, and writes the result to the standard out- put. The unexpand command puts tab characters into the data from the standard input, or the named files, and writes the result to the standard output. Backspace characters are preserved in the output and decrement the column count for tab calculations. The column position count cannot be decremented below one. The expand command is useful for preprocessing character files (before sorting, looking at specific columns, and so on.) that contain tab characters. By default, unexpand converts only spaces that are within sequences of spaces and tab characters at the beginnings of lines. Use -a to convert other sequences of spaces. NOTES
If the expand command encounters difficulties opening any specified file, it writes an error message to standard error and terminates imme- diately with an error status. If the unexpand command encounters difficulties opening any specified file, it writes an error message to standard error and continues operation. The exit status will reflect the error. EXIT STATUS
The following exit values are returned by either command: Successful completion. An error occurred. EXAMPLES
To replace tab characters in file with spaces, enter: expand file To replace the spaces in file with tab characters, enter: unexpand -a file ENVIRONMENT VARIABLES
The following environment variables affect the execution of expand and unexpand: 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 inter- nationalization variables 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). 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_MESSAGES. SEE ALSO
Commands: fold(1), tabs(1) Standards: standards(5) expand(1)
All times are GMT -4. The time now is 03:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy