A small question
I have a test.txt file
I have contents as:
a:google
b:yahoo
:
c:facebook
:
d:hotmail
How do I remove the line with :
my output should be
a:google
b:yahoo
c:facebook
d:hotmail
A small question
I have a test.txt file
I have contents as:
a:google
b:yahoo
:
c:facebook
:
d:hotmail
How do I remove the line with :
my output should be
a:google
b:yahoo
c:facebook
d:hotmail
grep -v "^:" inp
-----Post Update-----
grep -v "^:" test.txt
-----Post Update-----
grep -v "^:" test.txt
Try this
sed -e '/^:/d' b.sql > c.sql
Where, Contents of i/p File : b.sql
would be stricter.
Regards.
awk 'length > 1' "$file"
Or:
awk '/^:$/{next}1' "$file"
Or:
awk 'length - 1' "$file"
Or:
sed -n '/../p'
etc., etc., ...
Of course, the right answer depends on a more specific statement of the problem.
The criterion given was, "How do I remove the line with :". All the lines have a colon, so presumably the requirement is, "How do I remove the lines with nothing but a :".
To remove the lines containing only a colon.
grep -v '^:$' test.txt