10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello.
I would like to write a bash function which would return "true" if the search succeed else return anything else.
something like
if ] ; then
exit 1
fi
function my_funct () {
find first occurrence $2 in $1
if not found return "false"
from that position,... (6 Replies)
Discussion started by: jcdole
6 Replies
2. Shell Programming and Scripting
Hi, i have a strange prob. log file contains ip, protocol, user name, agent . these can be in any order. If log contains the above order able to fetch all details but if details are in diff order not able to fetch all details.
using below command.
grep -A50 "Entry " "/logs/file.log" \
|grep... (6 Replies)
Discussion started by: Satyak
6 Replies
3. Shell Programming and Scripting
My input is:
hello how are you
my chemistry book is lost
what is up
etc...
And I want the output to be:
you are how hello
lost is book chemistry my
up is what
....
I found an earlier response to a similar question but it was not accurate as it required a certain string length for each line (2 Replies)
Discussion started by: Heidi Heweidy
2 Replies
4. UNIX for Dummies Questions & Answers
Hello, I am new to awk and I was wandering if I could reverse line and word order from a text file using awk. I figured out how to do them both separately, but can't quite figure out how to mix them.
Example:
Input file:
dog cat mouse
1 2 3
I am new to awk
Output of the awk program:... (3 Replies)
Discussion started by: blink_w
3 Replies
5. Shell Programming and Scripting
how can i reverse the line order in text files?
(but total number of the lines is not constant )
for example i have a file like this:
line1
line2
line3
.
.
lineN
i wantto make it like this:
lineN
.
.
.
line3 (26 Replies)
Discussion started by: gfhgfnhhn
26 Replies
6. Shell Programming and Scripting
Hi -
I have a file with lots of lines in that I need to order based on the number of commas!
e.g the file looks something like :-
cn=john,cn=users,cn=uk,dc=dot,dc=com
cn=john,cn=users,dc=com
cn=users,cn=groups,dc=com
cn=john,cn=admins,cn=users,cn=uk,dc=dot,dc=com... (4 Replies)
Discussion started by: sniper57
4 Replies
7. Shell Programming and Scripting
Hi,
I could not find this anywhere and I am wondering if someone knows a quick way of doing this.
So heres the problem... I have a row that looks like this (an example):
5 4 3 2 1
What I want to do is reverse it so it looks like this:
1 2 3 4 5
Does anyone know the simple unix... (7 Replies)
Discussion started by: kylle345
7 Replies
8. UNIX for Dummies Questions & Answers
I have a text
"abc def ghi"
and I want to get it as
"def abc ghi"
I am using this
echo "abc def ghi" | sed 's/\(*\)\(*\)/\2\1/'
But I am not able to get the output, could anyone help me.
Thanks (9 Replies)
Discussion started by: venu_nbk
9 Replies
9. Shell Programming and Scripting
If I have string { I_love_shell_scripts}
anyone knows how to have output {stpircs_llehs_evol_I}
by using shell and perl ?I know in perl, there is reverse() funcation, but
can it be done by not using reverse()? (3 Replies)
Discussion started by: ccp
3 Replies
10. UNIX for Dummies Questions & Answers
so i have been trying to learn how to manipulate text on my own and have gotten stumped...
let's say i have a text file that says (highly simplified):
people ordinary
How would swap the order of the words..
I know i need to use sed and some kind of back reference but cannot make it... (2 Replies)
Discussion started by: urtherhoda
2 Replies