top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Write a unix command to display the every character in the word "QUERYHOME" in new line.

0 votes
424 views

Write a unix command to display the every character in the word "QUERYHOME" in new line.

Ex : Input - QUERYHOME
output: Q
U
E
R
Y
H
O
M
E

posted Jun 29, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
#include<stdio.h>
main()
{
        char *p="QUERYHOME";
        while(*p)
                printf("%c\n",*p++);
}
answer Jun 30, 2016 by Chirag Gangdev
The guy asked for unix command
Sir, I think,
There is no such command to do that, He can compile this code and create his own command.
I think we can use mix of sed or fold and echo something like
$ echo "QUERYHOME" | sed -e 's/\(.\)/\1 /g' | tr ' ' '\n'
$ echo "QUERYHOME" | fold -w 1

This works perfect on command-line..
...