Newbie Alert:Reversing part of a string?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Newbie Alert:Reversing part of a string?
# 1  
Old 02-09-2011
Newbie Alert:Reversing part of a string?

Hello all,

Wondering if anyone can help me out.

Trying to cut the names out of the /etc/passwd file so that they can be displayed first then last name. I cut them out and put them into variables but cant get them to display side by side after cutting. Anyone able to help a newbie?
# 2  
Old 02-10-2011
How does a name look like in your /etc/passwd file and what have you tried so far?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting part of a string : string manipulation

i have something like this... echo "teCertificateId" | awk -F'Id' '{ print $1 }' | awk -F'te' '{ print $2 }' Certifica the awk should remove 'te' only if it is present at the start of the string.. anywhere else it should ignore it. expected output is Certificate (7 Replies)
Discussion started by: vivek d r
7 Replies

2. Programming

Some error with number of keyboard inputs occured with this code for reversing a string..

i used a two-way linked list "node" for the code:: #include<stdio.h> #include<malloc.h> void insert(); void reverse(); struct node { char c; struct node *next; struct node *back; }*start=NULL; int main() { int n,i; (4 Replies)
Discussion started by: mscoder
4 Replies

3. Shell Programming and Scripting

Need to take one part from a string

I have a string something like "/opt/src/default.cfg" OR /opt/src/common/one This whole string stored in an array. The problem is this string is not constant and it will keep on changing as lot of strings are stored in the array and it will be look like :- case 1 /opt/src/default.cfg ... (8 Replies)
Discussion started by: Renjesh
8 Replies

4. Shell Programming and Scripting

extract last part of string.

Hi, I have a string like this BUNDLE=/home/bob/flx/user.bun how to extract only the the last part ie, only user.bun (2 Replies)
Discussion started by: vprasads
2 Replies

5. Shell Programming and Scripting

Part of a string

Hi mates, I am doing a script in ksh. I have the following string: /opt/one/two/four/five/myFile.txt And I have a variable: echo "${variable}" -> /opt/one/two/ I would like to have just the string: four/five/myFile.txt What is the better way to do that? Thanks in... (3 Replies)
Discussion started by: gonzaloron
3 Replies

6. Shell Programming and Scripting

Getting part of a string

Hi, I have a string assinged to a varaible as below. FILE=/var/adm/message If $FILE is the value where it stores the path of message file. I would like to extract the location of the file message as below LOCATION=/var/adm FILE may have value like /var/adm/xxxx/message ... (2 Replies)
Discussion started by: raghu.amilineni
2 Replies

7. Shell Programming and Scripting

reading and reversing a string

Hi Everyone....I am new to Unix and BASH programming...I just want to read a string and reverse it and display.....can anyone help me out???? (8 Replies)
Discussion started by: nikhilneela
8 Replies

8. Shell Programming and Scripting

perl newbie: how to extract an unknown word from a string

hi, im quite new to perl regexp. i have a problem where i want to extract a word from a given string. but the word is unknown, only fact is that it appears as the second word in the string. Eg. input string(s) : char var1 = 'A'; int var2 = 10; char *ptr; and what i want to do is... (3 Replies)
Discussion started by: wolwy_pete
3 Replies

9. Shell Programming and Scripting

output string in reversing order

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. Shell Programming and Scripting

Reversing and trim a String through SHELL script

All I want to reverse and trim a string using UNIX shell scripts.Iam using Bourne shells. Can you help me? Thanx in advance Regards Deepak (5 Replies)
Discussion started by: DeepakXavier
5 Replies
Login or Register to Ask a Question