11-19-2010
@dragon
sed '/^$/d' infile will delete empty lines, but not whitespace-only lines..
This User Gave Thanks to Scrutinizer For This Post:
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
HI all
I have a problem, I need to replace a field in a file, but only in the lines that have some pattern, example:
100099C01101C00000000059394200701CREoperadora_TX
100099C01201C00000000000099786137OPERADORA_TX2
in the example above I need to change the first field from 1 to 2 only if... (3 Replies)
Discussion started by: sergiioo
3 Replies
2. Shell Programming and Scripting
I got a sample file like this.
$ cat test
12|13|100|s
12|13|100|s
100|13|100|s
12|13|100|s
I want to replace all 100 by 2000 only in 3rd field using "awk"
This is replacing all 100's :-(
$ awk -F "|" '{gsub( /100/,"2000");print}' test
12|13|2000|s
12|13|2000|s
2000|13|2000|s... (5 Replies)
Discussion started by: jkl_jkl
5 Replies
3. UNIX for Dummies Questions & Answers
I have a file 'test.out' with contents:
1|1|10|10|I|asdf|
2|1|10|10|I|sdfg|
4|1|10|10|I|hgfj|
34|0|10|10|I|sdg|
I want to modify the fifth column with value 'I' to 'A' for only the last line. Below is what I expect to see:
1|1|10|10|I|asdf|
2|1|10|10|I|sdfg|
... (3 Replies)
Discussion started by: ChicagoBlues
3 Replies
4. Shell Programming and Scripting
Hello All,
I have a file with contents like
apple|ball|charlie|David|
England|France|Germany|
Ireland|Japan|King|London|
Man|Nancy|Orange|
here the column delimiter is |
so if any of the lines/rows in the file has 3 only records (last field is empty), i want to place a | at the end of... (4 Replies)
Discussion started by: vinredmac
4 Replies
5. Shell Programming and Scripting
Something like vlookup in excel, column 2 in file 2 is blank and should be replaced by column 2 in file 1 based on comparing column 1 in both files.
file1
Code:
1234~abc~b~c~d~e~f~g~h~09/10/09
5678~def~b~c~d~e~f~g~h~12/06/10
8910~hij~b~c~d~e~f~g~h~03/28/13... (1 Reply)
Discussion started by: sigh2010
1 Replies
6. Shell Programming and Scripting
Find a blank field
Hi
I have set of fields that have some blank values, how to find that and get its line noumbers in output file.
Ex:
Col1 col2 col3
11 ss 103
12 104
13 105
14 se 106 (2 Replies)
Discussion started by: Shenbaga.d
2 Replies
7. Shell Programming and Scripting
hi,
i having a file with | seperated in which i need to search char in 3rd column and replace with null. i need to replace only the coulmn where character occurs in 3rd field
for eg:
file1.txt
xx|yy|xx|12
output file:
xx|yy||12 (5 Replies)
Discussion started by: rohit_shinez
5 Replies
8. Shell Programming and Scripting
Hi All,
i have a file like
col1 col2 col3
13 24 NA
12 13 14
11 12 13
14 22 NA
18 26 NA
in this file if i found "NA" other values in the line are also replace by NA
Could you help me! (7 Replies)
Discussion started by: Shenbaga.d
7 Replies
9. Shell Programming and Scripting
hai guys,
pick the 1st field and calculate max length.
if suppose max length is 2,
then compare the all records if <2 then add zero's prefix of the record.
for ex:
s.no,sname
1,djud
37,jtuhe
in this max length of the 1st field is 2 right
the output wil be
s.no,sname
01,djud... (6 Replies)
Discussion started by: Suneelbabu.etl
6 Replies
LEARN ABOUT OPENSOLARIS
winsdelln
insdelln(3XCURSES) X/Open Curses Library Functions insdelln(3XCURSES)
NAME
insdelln, winsdelln - insert/delete lines to/from the window
SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib
-R /usr/xpg4/lib -lcurses [ library... ]
c89 [ flag... ] file... -lcurses [ library... ]
#include <curses.h>
int insdelln(int n);
int winsdelln(WINDOW *win, int n);
PARAMETERS
n Is the number of lines to insert or delete (positive n inserts; negative n deletes).
win Is a pointer to the window in which to insert or delete a line.
DESCRIPTION
The insdelln() and winsdelln() functions insert or delete blank lines in stdscr or win, respectively. When n is positive, n lines are
added before the current line and the bottom n lines are lost; when n is negative, n lines are deleted starting with the current line,
the remaining lines are moved up, and the bottom n lines are cleared. The position of the cursor does not change.
RETURN VALUES
On success, these functions return OK. Otherwise, they return ERR.
ERRORS
None.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO
deleteln(3XCURSES), insertln(3XCURSES), libcurses(3XCURSES), attributes(5), standards(5)
SunOS 5.11 5 Jun 2002 insdelln(3XCURSES)