Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Find the lines containing a number in a file

Posted By: Lauren Hughes     Category: Unix / Linux / Ubuntu     Views: 3107

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: 


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
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:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
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