Sponsored Content
Top Forums Shell Programming and Scripting delete empty spaces at specific column Post 302387892 by yonez on Monday 18th of January 2010 07:14:19 PM
Old 01-18-2010
Hi,

Thank you for replying.

But how do I go about doing it in every first occurrence of date after 8 white spaces? The statement itself has header and footer. Basically I need the header and footer untouch and only delete 2 spaces between Total column and Rate column. If I use cut, then I'm going to lose some of the data. I need to delete 2 whitespaces on every line that starts with date. Example as above.

Thanks again.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

want to remove " in a file and delete empty spaces

I have to remove character " in file which occurs at every line and have to delete empty spaces. Please help (2 Replies)
Discussion started by: vikram2008
2 Replies

2. Shell Programming and Scripting

Initializing empty string with spaces

Hi, I want to Initialize a String with 50 spaces. I can do that by ex: Var1=" " But i dont want to do in this way? Is there any unix command where i can specify no of spaces to a varaible? like space(50) (1 Reply)
Discussion started by: Shiv_18
1 Replies

3. UNIX for Dummies Questions & Answers

Delete a specific column using vi editor?

Hello Experts, I'm a newbie so please excuse any wrong doings. I have a file that looks like this. abc def ghi jkl mno def abc ghi mno jkl ghi def mno jkl abc I would like the file to look like this abc def ghi jklmno def abc ghi mnojkl ghi def mno jklabc in other... (3 Replies)
Discussion started by: fnebiolo
3 Replies

4. Shell Programming and Scripting

delete lines with empty second column

hi, I'd like to ask you if you can help me with such surely easy thing - I have some data and need to plot them. I have txt of data in two columns, tab separated, but some second columns are empty. like 1```` 2 1.2`` 3```` 2 4.44` 5````` 6.1```1 how can I erase all the lines... (2 Replies)
Discussion started by: bsco
2 Replies

5. Shell Programming and Scripting

delete a row with a specific value at a certain column

Hi, I want to delete rows that have 0 at column 4. The file looks like this: chr01 13 61 2 chr01 65 153 0 chr01 157 309 1 chr01 313 309 0 chr01 317 469 1 chr01 473 557 0 I want to delete all rows with a 0 at column 4 chr01 13 61 2 chr01 157 309 1 chr01 ... (3 Replies)
Discussion started by: kylle345
3 Replies

6. UNIX for Dummies Questions & Answers

Delete rows with unique value for specific column

Hi all I have a file which looks like this 1234|1|Jon|some text|some text 1234|2|Jon|some text|some text 3453|5|Jon|some text|some text 6533|2|Kate|some text|some text 4567|3|Chris|some text|some text 4567|4|Maggie|some text|some text 8764|6|Maggie|some text|some text My third column is my... (9 Replies)
Discussion started by: A-V
9 Replies

7. Shell Programming and Scripting

How to grep an empty line in a specific column of a file?

Suppose i have the following data : cat file.txt 12431,123334,55353,546646,14342234,4646,35234 123123,3535,123434,132535,1234134,13535,123534 123213,545465,23434,45646,2342345,4656,31243 2355425,2134324,53425,342,35235,23434,234535 3423424,234234,65465,,2344,35436,234524,234... (7 Replies)
Discussion started by: Ravi Tej
7 Replies

8. Shell Programming and Scripting

Delete column with exact string in specific col

Hi, my file structur looks like File structure looks: GeneID protein_gi Symbol 1246500 10954455 repA1 1246501 10954457 repA2 1246502 10954458 leuA But some of the cases do not have record for protein id. for example: 1343044 - orf01 I want to remove those rows. But I tried awk... (9 Replies)
Discussion started by: smitra
9 Replies

9. Shell Programming and Scripting

Overwrite specific column in xml file with the specific column from adjacent line

I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file. Here is the file. <!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
Discussion started by: rk4k
2 Replies

10. Shell Programming and Scripting

Shell script to delete empty files from specific locations

Hi, I need help in regard to developing a shell script to delete empty files from multiple specific locations. The directory paths will be stored in a text file. So the requirement is to read the text file for one specific path and then remove empty files from that particular path. Looping through... (4 Replies)
Discussion started by: Khan28
4 Replies
pr(1)							      General Commands Manual							     pr(1)

NAME
pr - Writes a file to standard output SYNOPSIS
pr [-adfFmprt] [-e] [character] [number] [-h header] [-i] [character] [gap] [-l lines] [-n] [character] [width] | [-x] [character] [number] [-o offset] [-s] [character] [-w width] [-column] [+page] [file...] The pr command writes file to standard output. If you do not specify file or if file is -, pr reads standard input. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: pr: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Displays multicolumn output across the page. (This option is meaningful only in combination with the -column option. It modifies -column so that columns are filled across the page in a round robin order.) Doublespaces the output. Expands tabs to byte positions number+1, 2*number+1, 3*number+1, and so on. The default value of number is 8. Tab characters in the input expand to the appropriate number of spa- ces to line up with the next tab setting. If you specify character (any character other than a digit) that character becomes the input tab character. The default value of character is the ASCII tab character. Uses a formfeed character to advance to a new page. (Otherwise, pr issues a sequence of newline characters.) Pauses before beginning the first page if the standard output is a terminal. Uses a formfeed character to advance to a new page. (Otherwise, pr issues a sequence of newline characters.) Does not pause before beginning the first page if the standard output is a terminal. Displays header instead of the file name in the page header. Replaces multiple space charac- ters with tab characters wherever two or more space characters reach positions gap+1, 2*gap+1, 3*gap+1, and so on. The default value of gap is 8. If you specify character (any character other than a digit), that character becomes the output tab character. (The default value of character is the ASCII tab character.) Sets the length of a page to lines lines (the default is 66). If lines is not greater than the sum of the header and trailer, pr suppresses both header and trailer, as if -t were in effect. Combines and writes all files at the same time, with each file in a separate column. (This overrides the -column and -a options). Provides width-digit line numbering (the default value of width is 5). The number occupies the first width positions of each column of normal output (or each line of -m output). If you specify character (any character, other than a digit), that character is added to the line number to separate it from whatever fol- lows. (The default value of character is an ASCII tab character.) Indents each line of output by offset byte positions (the default is 0). This is in addition to output width (see -w). Pauses before beginning each page if the output is directed to a terminal. (pr sounds the bell at the terminal and waits for you to press <Return>.) Does not display diagnostic messages if the system cannot open files. Sep- arates columns by the single character instead of by the appropriate number of spaces (the default for character is an ASCII tab charac- ter). Does not display the 5-line identifying header and the 5-line footer. Stops after the last line of each file without spacing to the end of the page. [Tru64 UNIX] Same as -n. Sets the width of a line to width byte positions. If neither -w or -s are specified, the default is 72. If only -s is specified, the default is 512. Single column output is not truncated. Produces the specified number of col- umns (the default value is 1). The -e and -i options are assumed for multicolumn output. A text column never exceeds the width of the page (see -l). Begins the display at the specified page number (the default value is 1). Note When used with arguments, the -e, -i, -n, -s, and -x options do not permit white space between the option and its associated argu- ment, or between multiple arguments. OPERANDS
The path name of a file to written. If no file is specified, or - (hyphen) is specified, standard input is used. DESCRIPTION
A heading that contains the page number, date, time, and the name of the file separates the output into pages. Unless specified, columns are of equal width and separated by at least one space. Lines that are too long for the page width are short- ened. If the standard output is a terminal, pr does not display any error messages until it has ended. By default, the input is separated into 66-line pages, including the 5-line header and 5-line footer. If standard output is a terminal, diagnostic (error) messages produced during the operation of pr will be deferred and printed after pr has completed processing. EXIT STATUS
The following exit values are returned: All files have been successfully written. An error occurred. EXAMPLES
To print a file with headings and page numbers on the printer, enter: pr prog.c | lpr This inserts a page break in prog.c, starts each page with a heading, and sends the output to the print command. The heading con- sists of the date the file was last modified, the file name, and the page number. To specify a title, enter: pr -h "MAIN PRO- GRAM" prog.c | lpr This prints prog.c with the title MAIN PROGRAM in place of the file name. The modification date and page number are still printed. To print a file in multiple columns, enter: pr -3 word.lst | lpr This prints the file word.lst in three vertical columns. To print several files side-by-side on the paper, enter: pr -m -h "Mem- bers, Visitors" member.lst visitor.lst | lpr This prints the files member.lst and visitor.lst side-by-side with the title Members, Visitors. To modify a file for later use, enter: pr -t -e prog.c > prog.notab.c This replaces tab characters in prog.c with spaces and puts the result in prog.notab.c. Tab positions are at byte positions 9, 17, 25, 33, and so on. The -e tells pr to replace the tab characters; the -t suppresses the page headings. ENVIRONMENT VARIABLES
The following environment variables affect the execution of pr: 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). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the format of the date and time used in writing header lines. Determines the location of message catalogues for the processing of LC_MESSAGES. FILES
Your terminal, used when the -p option is specified. SEE ALSO
Commands: cat(1), expand(1), mesg(1) Standards: standards(5) pr(1)
All times are GMT -4. The time now is 04:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy