Welcome -
Guest!
Login
/
Register Now
|
Search:
Home
Articles
Forum
Interview FAQ
Activities
News
Videos
Poll
Links
People
Groups
Unix / Linux / Ubuntu Articles
Submit Article
Home
»
Articles
»
Unix / Linux / Ubuntu
»
Homework Help
RSS Feeds
Find the lines containing a number in a file
Posted By:
Lauren Hughes
Category:
Unix / Linux / Ubuntu
Views:
3087
Find the lines containing a number in a file.
Code for Find the lines containing a number in a file in Unix / Linux / Ubuntu
echo Enter filename read filename grep [0-9] $filename
Share:
Previous Post:
Find all lines in a file with words longer than 4 characters, assuming that words are separated by s
Next Post:
Write a shell script to display the digits which are in odd position in a given 5 digit number
Didn't find what you were looking for? Find more on
Find the lines containing a number in a file
Or get
search suggestion and latest updates
.
Lauren Hughes
author of Find the lines containing a number in a file is from London,
United Kingdom
.
View All Articles
Related Articles and Code:
Find the lines containing a number in a file
Write a shell script to find the average of the numbers entered in command line
Shell Script to find out the sum of the given numbers using command line argument
PROLOG PROGRAM TO SPLIT A LIST IN TWO LISTS SUCH THAT ONE LIST CONTAINS NEGATIVE NUMBERS AND ONE CONTAINS POSITIVE NUMBERS
Program that will accept a line of text from the text file; count the number of words, lines, and characters in the file
Program that counts number of line, number of words and number characters in specified string
Program to find total numbers vowels, constants and digits in an input file
Find all lines in a file with words longer than 4 characters, assuming that words are separated by spaces except at the begining or end of line
Find all lines in a file with words longer than 4 characters, assuming that words are separated by spaces except at the beginning or end of line
Find the yearly Depreciation. Yearly Depreciation = (Cost - Scap Value) / Years of life.Output file should contain no name no of year and depreciated
Program that will count the number of lines in each file that is specified on the command line
Prolog program to read a file and display each of its line one by one and lines chosen by user should go to an output file
Read a file and count number of word, character, lines, display in reverse, convert lower to upper, upper to lower case,count particular word in file
File handling program to count number of characters in a file
Count no.of lines in file abc?
Program to find minimum and maximum number from user specified 3 numbers
Program to find entered number is prime number or not
Program to find whether the given number is a palindrome number or not
Program to find greatest number from two numbers using if statement
Program to perform operations like Count char,words and lines of file, display file in reverse, change case and frequency of a particular word in file
Other Interesting Articles in Unix / Linux / Ubuntu:
Display information about all the current programs running
Write a shell script to search all files and rename them such that they do not contain the shell PID.
Write a shell script, which displays a list of all files in the current directory to which you have read, write and execute permissions
Unix Commands and description of ls,logout,mkdir,rmdir,rm,cd,man,talk,write,pico,pine,more,sz,rz,telnel,ftp,archie,irc,lynx,gopher,tin,trn,passwd etc
Wild cards and examples in unix
Write a shell script, which will receive any number of filenames as arguments .The shell script should check whether such files already exist.
Suppose four filenames are supplied then the first file should get copied into second file, the third file should get copied into four
Shell Script to find out the sum of the given numbers using command line argument
How would we see content of the file?
Display your login name
Write a shell script to display the digits which are in odd position in a given 5 digit number
Write a shell script to find the largest among the 3 given numbers
Program to calculate the area and perimeter of the rectangle
Append abc.txt, xyz .txt
Overview of UNIX
How would you count the number of words, lines and character of a file?
Explain the difference between echo “$SHELL” and echo ‘$SHELL’
Create a directory - mkdir
Which command given information of present working directory?
Ex mode command in unix
Please enter your Comment
*
*
Comment should be atleast 30 Characters.
Please put code inside [Code] your code [/Code].
Please login to post comment
Sanjeet Kumar
from
India
Comment on:
Jun 13
Hi All,
I am writing a script which give notification through mail when passwrod will be exprie.E.g. i want notification of password expiry befor 15 days of password expiry.Could you please suggest about the script.
I have writren script in LINUX flavour by using "chage" command,but this command is not working in SOLARIS.
My code is as below:
#!/bin/sh
datediff()
{
d1=$(date -d "$1" +%s)
d2=$(date -d "$2" +%s)
return $(( ($d1 - $d2) / 86400 ))
}
d1=$(chage -l user_name | grep "Password expires" | cut -d ":" -f 2 | cut -d "," -f 1)
d2=$(date '+%h %d')
d3=$(chage -l user_name | grep "Last password change")
d4=$(chage -l user_name | grep "Password expires")
#d5=$(chage -l user_name | grep "Password inactive")
d6=$(chage -l applsupp | grep "Maximum number of days between password change")
datediff "$d1" "$d2"
pwd_exp=$?
#-----------------------------If Else Loop for email alert---------------------------------------------------------#
if [ $pwd_exp -le 15 ]
then
echo -e "Your Password Will Expire In $pwd_exp Days.
else
date
echo "Password expiry has not yet crossed threshold "
fi
Sanjeet Kumar
from
India
Comment on:
Jun 12
I want password exipry script on solaris flavour not on LINUX.Please provide that
View All Comments
Unix / Linux / Ubuntu
View All
Advance
Basics
Commands
Homework Help
Interview FAQ
Terms and Terminology
Assembly Language
Artificial Intelligence
C Programming
C++ Programming
Visual C++
OOAD
Cobol
Java
SQL Server
Asp.net MVC
Rest and WCF Services
Entity Framework
Knockout.Js
Networking
OOPs Concept
HTML
Dos
SQL
System Analysis & Design
Gadgets
Internet
CSS
Javascript
.Net Framework
Asp.net
C#
VB.Net
Python
Perl
Oracle
Software Engineering
RDBMS Terms
AJAX Framework
Design Pattern
UML
WPF
WCF
SEO
PowerShell
Visual Studio
WWF
BizTalk Server
Azure
General
Testing
Online Certifications
PHP
My SQL
LinQ
Project Management
Silverlight
XML
MS Office
Windows OS
DHTML
Sharepoint