\s is not valid in posix-compliant posix (perhaps it's a gnu sed extension, but I'm not sure). Even if it's allowed, that regular expression would only match a line with one matching character. And, since sed prints all lines by default, the p command in this case will cause matching lines to print twice.
Two portable sed alternatives:
The first disabled printing by default, with the -n option, and then only prints lines that consist of nothing but the allowed characters. The second option deletes all lines that do not consist of all matching characters.
Regards,
Alister
---------- Post updated at 11:56 AM ---------- Previous update was at 11:53 AM ----------
I've been having vision troubles the past few days. Seconds after posting, I noticed anbu's post. Mine is essentially the same, except it uses character classes.
Thanks a lot anbu23 and Alister, it was very helpful. I have a doubt. how can i do this task for a particular part of the line..for example, i want to check for the special characters in all lines from position 10 to 20 only..
Hello to all.
This is first post. Kindly excuse me if I do not adhere to any rules and regulations of this forum.
I have a file containing some rows with three columns each per row(separeted by a space). There are certain rows for which first two columns have same value but the value in... (6 Replies)
Hi again,
I need to further process the results of a previous manipulation.
I have a file with three columns
e.g.
AAA5 0.00175 1.97996e-06
AAA5 0.01334 2.14159e-05
AAA5 0.01340 4.12155e-05
AAA5 0.01496 1.10312e-05
AAA5 0.51401 0.0175308
BB0 0.00204 2.8825e-07
BB0 0.01569 7.94746e-07
BB0... (6 Replies)
I have a set of data as below:
The first field, $1 represent "|".
The $3 (3rd field) and $6 (6th field) in my data file represent "number-molecule" which has arrangement as below:
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
17 18 19 20 21 ... (9 Replies)
I have a file which contains five hundred thousand lines (500,000). I want to select lines of every 1000 lines from that file using AWK. I can think something like this in bash as below:
for lines in {0..500000..1000}
do
........
........
done
But I want to use AWK. I do not know how to... (4 Replies)
Hello experts,
I am new to this group and to 'SED' and 'AWK'. I have data (text file) with 5 columns (C_1-5) and 100s of lines (only 10 lines are shown below as an example). I have to find or select only the id numbers (C-1) of specific lines with '90' in the same line (of C_3) AND with '20' in... (6 Replies)
Say I wanted to select the 5th line of a file without knowing the context of the file. Would I use grep and pipe it into wc or is there a more simple way of doing this? (3 Replies)
Hi All,
Is there a way to get a range of lines from a file??? I want to search through a set of scripts and need to select the group of lines which do the FTP.
Say,
Line1
Line2
ftp SERVER
user UNAME PASS
send FILE_TO_BE_SENT
close
Line3
Line4
Line5
ftp SERVER1
user USER1 PASS1... (6 Replies)
Hi All,
I am creating a script that sends log data from text files to a Database and I will like to read sugestions, as I think that there might be better ways to achive this than with my shell script; maybe perl or I don't know, but I will like to read some sugestions.
The log is from... (10 Replies)
Hi,
I have a file having some thousand records with the following sort of lines:
Error: Failed to get order data
Order: PO-BBBTGZE
Error: No CLI
Error: Failed to get order data
Order: PO-SBDJUZA
Order: PO-XBBIDEN
Error: No CLI
Error: Failed to get order data
Order: PO-BBDJUTQ
Order:... (2 Replies)