Upload files to "OS/bash/Week3"
This commit is contained in:
parent
a815332403
commit
aa546c4fcb
17
OS/bash/Week3/q7.sh
Normal file
17
OS/bash/Week3/q7.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Enter the text file"
|
||||
read file
|
||||
|
||||
line_no=1
|
||||
while IFS= read -r line;do
|
||||
if [ "$((line_no%2))" -eq 1 ]; then
|
||||
echo "$line" >> temp
|
||||
fi
|
||||
((line_no++))
|
||||
done<"$file"
|
||||
|
||||
mv temp "$file"
|
||||
|
||||
echo "Even numbered lines deleted"
|
||||
|
Loading…
x
Reference in New Issue
Block a user