Sponsored Content
Top Forums UNIX for Dummies Questions & Answers erasing portion of line with sed Post 77377 by reborg on Thursday 7th of July 2005 03:01:34 PM
Old 07-07-2005
Code:
sed '/^[    ]*$/d' huge_file

[ ] contains one space and one TAB character.

However perl would probably be a better tools to do this to a hugh file.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

erasing portion of line with sed (only once)

hi, I'm trying to use sed to erase everything, up to the first parenthesis. for example: input: blah blah blah (aldj) test (dafs) test test. output: (aldj) test (dafs) test test. how would i do this? I was fooling around with the parenthesis, and i only got it to apply on all parenthesis.... (1 Reply)
Discussion started by: gammaman
1 Replies

2. Shell Programming and Scripting

awk program to select a portion of a line

Hi all, I am new to awk programs.I have a file like this vjfavhjlaf<LTEXT>aabcdfffvvbbxbcddjbv</LTEXT>fAFdfdADfd vjfavhjlaf<LTEXT>aabcdfffvvbbxbcddjbv</LTEXT>fAFdfdADfd vjfavhjlaf<LTEXT>aabcdfffvvbbxbcddjbv</LTEXT>fAFdfdADfd vjfavhjlaf<LTEXT>aabcdfffvvbbxbcddjbv</LTEXT>fAFdfdADfd... (3 Replies)
Discussion started by: anju
3 Replies

3. Shell Programming and Scripting

Delete a portion of a line using shell scripting

Hi all, I am new to awk programs.I have a file like this 1234567@2345||adcbdefhij: asgdfdasdfhhfd-asdfasd-dsfasdf |0.678|0.0|0.213 1234567@2345||adcbdefhij: ashhfd-asdfasd-dsfasdf |0.129|0.0|0.411 1234567@2345||adcbdefhij: asd-aasd-dasdf |0.223|0.0|0.276 I want to delete the text which... (3 Replies)
Discussion started by: Loy81
3 Replies

4. Shell Programming and Scripting

Print a portion of a line

Hi, I am facing a little problem... I have a line like this : asdcvashfasashXXXXxxxzxcadd:sdcashjqdasdsmgdkdaxdsnd; I want to print just a portion of line i.e starting from left 5 characters from ":" and upto ";" i.e. in this case it would be "xcadd:sdcashjqdasdsmgdkdaxdsnd;" The length of... (2 Replies)
Discussion started by: vanand420
2 Replies

5. Shell Programming and Scripting

Print portion line in SED

Hi, This is more a theoretical question, because I usually solved that with perl or even java, but I would like to know if it exists an easy way to do it with SED. Using regular expresions it's very easy to select an portion line. Does it exist an easy way for printing those portions in SED?... (1 Reply)
Discussion started by: islegmar
1 Replies

6. Shell Programming and Scripting

extract string portion using sed

Hi All I have 3 files as listed below and highlighted in bold the portions of the filenames I need to extract: TOS_TABIN218_20090323.200903231830 TOS_TABIN219_1_20090323.200903231830 TOS_TABIN219_2_20090323.200903231830 I tried source_tabin_name=`echo $fname | sed 's/_.*//'` but I... (6 Replies)
Discussion started by: santam
6 Replies

7. Shell Programming and Scripting

extract string portion from filename using sed

Hi All, I posted something similar before but I now have a another problem. I have filenames as below TOP_TABIN240_20090323.200903231830 TOP_TABIN235_1_20090323.200903231830 i need to extract the dates as in bold. Using bash v 3.xx Im trying to using the print sed command but... (11 Replies)
Discussion started by: santam
11 Replies

8. Shell Programming and Scripting

printing portion of the output usind sed/awk

friends, i am a newbie in scripting. could someone help me in selecting only the last column of below ps command output ? mqm 14 16466 0 Sep 15 ? 0:01 /opt/mqm/bin/runmqlsr -r -m QMGR.INBOUNDSSL -t TCP -p 1415 -i 5.1.26.5 mqm 12 16700 0 Sep 15 ? 0:00... (4 Replies)
Discussion started by: unahb1
4 Replies

9. Shell Programming and Scripting

How to grep a portion of line

Mysql log has something like: I want to grep only the portion "ernie-1328697839.1233158" from each line. How to do this? (6 Replies)
Discussion started by: proactiveaditya
6 Replies

10. Shell Programming and Scripting

Shell to display portion of a line

Thanks a lot for the code and the explanation. Now my final requirement. I have uploaded 3 files as attachment. Please open the files in Editplus or any other text editor which keeps the formatting. GMDCOM.27936.log.txt------I want to pick only Process request from this file.(Please check... (9 Replies)
Discussion started by: ghosh_tanmoy
9 Replies
expand(1)							   User Commands							 expand(1)

NAME
expand, unexpand - expand TAB characters to SPACE characters, and vice versa SYNOPSIS
expand [-t tablist] [file]... expand [-tabstop] [-tab1, tab2,. . ., tabn] [file]... unexpand [-a] [-t tablist] [file]... DESCRIPTION
The expand utility copies files (or the standard input) to the standard output, with TAB characters expanded to SPACE characters. BACKSPACE characters are preserved into the output and decrement the column count for TAB calculations. expand is useful for pre-processing character files (before sorting, looking at specific columns, and so forth) that contain TAB characters. unexpand copies files (or the standard input) to the standard output, putting TAB characters back into the data. By default, only leading SPACE and TAB characters are converted to strings of tabs, but this can be overridden by the -a option (see the OPTIONS section below). OPTIONS
The following options are supported for expand: -t tablist Specifies the tab stops. The argument tablist must consist of a single positive decimal integer or multiple posi- tive decimal integers, separated by blank characters or commas, in ascending order. If a single number is given, tabs will be set tablist column positions apart instead of the default 8. If multiple numbers are given, the tabs will be set at those specific column positions. Each tab-stop position N must be an integer value greater than zero, and the list must be in strictly ascending order. This is taken to mean that, from the start of a line of output, tabbing to position N causes the next character output to be in the (N+1)th column position on that line. In the event of expand having to process a tab character at a position beyond the last of those specified in a multiple tab-stop list, the tab character is replaced by a single space character in the output. -tabstop Specifies as a single argument, sets TAB characters tabstop SPACE characters apart instead of the default 8. -tab1,tab2,...,tabn Sets TAB characters at the columns specified by -tab1,tab2,...,tabn The following options are supported for unexpand: -a Inserts TAB characters when replacing a run of two or more SPACE characters would produce a smaller output file. -t tablist Specifies the tab stops. The option-argument tablist must be a single argument consisting of a single positive decimal inte- ger or multiple positive decimal integers, separated by blank characters or commas, in ascending order. If a single number is given, tabs will be set tablist column positions apart instead of the default 8. If multiple numbers are given, the tabs will be set at those specific column positions. Each tab-stop position N must be an integer value greater than zero, and the list must be in strictly ascending order. This is taken to mean that, from the start of a line of output, tabbing to posi- tion N will cause the next character output to be in the (N+1)th column position on that line. When the -t option is not specified, the default is the equivalent of specifying -t 8 (except for the interaction with -a, described below). No space-to-tab character conversions occur for characters at positions beyond the last of those specified in a multiple tab-stop list. When -t is specified, the presence or absence of the -a option is ignored; conversion will not be limited to the processing of leading blank characters. OPERANDS
The following ooperand is supported for expand and unexpand: file The path name of a text file to be used as input. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of expand and unexpand: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWesu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
tabs(1), attributes(5), environ(5), standards(5) SunOS 5.11 1 Feb 1995 expand(1)
All times are GMT -4. The time now is 06:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy