How to split given string in line by line in unix [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Consider the following string "google" . I want to split the following string as below using simple bash script. please help me out.
g
o
o
g
l
e

Another solution with fold :
echo "google" | fold -w1

Related

How to do string concatation to make a list [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Let I have two string. Say, "learn" and "haskell". How can make them list like ["learn","haskell"]
makeListFromTwoThings :: a -> a -> [a]
makeListFromTwoThings x y = [x,y]
Edit: I am assuming you want a function that does this generically. If you want to do this in the Haskell shell then it seems like nothing is stopping you from typing ["learn","haskell"] directly. If you are trying to solve some more general problem directly in the shell then let us know the details of that problem.

In Perl, what is the efficient way to replace a String dynamically with something else? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a file containing many lines like
"resourcename" : "myfile.pdf",
I want to replace everywhere myfile.pdf with an URL like http://somedomain.com/myfile.pdf. But the file name keeps changing. So if myfile.pdf becomes yourfile.pdf, I want to replace it with http://somedomain.com/yourfile.pdf.
What is an efficient way to do global replacement(/g) without affecting the file's encoding like UTF-8?
Thanks

Trim a file using tail in linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How do I reduce the size of a file using tail?
I just need the last 1000 lines of the file. I need the trimmed file name to remain the same.
tail -1000 file.txt
To make a new file
tail -1000 file.txt > newfile.txt

How to Remove a matched line inside a file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need a shell script that should remove the matched pattern .
Can anyone please help me ?
The command is
sed -i -e '/yourpattern/d' your_file

How to use pipe to output id-address from a file and login? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have an ip-address stored in a file. I want to use a single-line command to output the ip-address from this file and then ssh log in this remote machine.
How can I get it with pipe.
If you have a file that says
# cat test
192.168.32.205
then just do:
ssh root#$(cat test)

Resources