Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gitlab-inlab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huffleclaw
gitlab-inlab
Commits
49f9ec62
Commit
49f9ec62
authored
Aug 10, 2017
by
ONKAR PIYUSH PRPADEEP
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete script3.sh
parent
f410e263
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
55 deletions
+0
-55
Lab3/script3.sh
Lab3/script3.sh
+0
-55
No files found.
Lab3/script3.sh
deleted
100644 → 0
View file @
f410e263
#!/bin/bash
if
[
"
$2
"
==
"-lines"
]
then
{
lines
=
$((
$(
grep
-c
^
$1
)
))
echo
"
$lines
lines"
}
elif
[
"
$2
"
==
"-words"
]
then
{
grep
-E
-o
'\b\w+\b'
$1
>
output
awk
'/$/!p {count++}END{if(count!=0){print count,"words"}else{print "0 words";}}'
output
rm
output
}
elif
[
"
$2
"
==
"-chars"
]
then
{
grep
-E
-o
'(\S)'
$1
>
charac
awk
'/$/!p {count++}END{if(count!=0){print count,"characters"}else{print "0 characters";}}'
charac
rm
charac
}
elif
[
"
$2
"
==
"-paras"
]
then
{
#sed -n '/^$/N;/^\n$/D' $1
#awk '{if(!$0)count++}END{if(count!=0){print count,"paragraphs"}else{print "0 paragraphs";}}' $1
sed
-e
:a
-e
'/./,$!d;/^\n*$/{$d;N;};/\n$/ba'
$1
>
file1
grep
-cvP
'\S'
file1
>
z
line1
=
$(
head
-n
1 z
)
r
=
$((
$line1
+
1
))
echo
"
$((
$r
-
3
))
"
rm
z
rm
file1
}
else
{
grep
-E
-o
'\S'
$1
>
charac
awk
'BEGIN {ORS=" "}/$/!p {count++}END{if(count!=0){print count,"characters,"}else{print "0 characters,";}}'
charac
rm
charac
grep
-E
-o
'\b\w+\b'
$1
>
output
awk
'BEGIN {ORS=" "}/$/!p {count++}END{if(count!=0){print count,"words,"}else{print "0 words,";}}'
output
rm
output
lines
=
$((
$(
grep
-c
^
$1
)
))
echo
-n
"
$lines
lines, "
#sed -n '/^$/N;/^\n$/D' $1
sed
-e
:a
-e
'/./,$!d;/^\n*$/{$d;N;};/\n$/ba'
$1
>
file1
grep
-cvP
'\S'
file1
>
z
line1
=
$(
head
-n
1 z
)
r
=
$((
$line1
+
1
))
echo
"
$((
$r
-
3
))
paragraphs"
rm
z
;
rm
file1
#awk '{if(!$0)count++}END{if(count!=0){print count,"paragraphs"}else{print"0 paragraphs";}}' $1
}
fi
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment