Fist post, so be kind... I have written an expect script which logs into a terminal and gathers several screens of information. Unfortunately the log file gives me all the special escape and control characters from the terminal. I am hoping to use a combination of shell scripting, sed, and awk to clean it up and retain the spacing. I have cleaned the output to the point where it is in the following format:
The ;numberH portion of the line indicates where the cursor should start writing the next portion of text. So what I want to do is insert the correct number of spaces where this information is.
Here is the way I figure the logic should go. Each of the values between the ; and H need to have 1 subtracted from them because the value is actually the position of the first character. Then, starting from the end of the line, the value needs to have the previous value and the number of characters subtracted, in order to find the number of spaces between the words. It should ultimately look like this:
Hope this all makes sense, Thanks in advance for your help!
I have several lines in a file that I want to replace a space with a tab.
For example:
111047 Julie Jones email@email.com
111047 Julie Jones email@email.com
I want to replace the space after the word "jones" with a tab.
How do I achieve that in Vi?
Please assist.
Thanks! (5 Replies)
Hi All,
I have written a C program to solve this problem but I am eager to know whether the same output can be obtained using sed or awk?
This is the input:
star
ferry
computer
symbol
prime
time
This is the output:
starferry
ferrycomputer
computersymbol
symbolprime
primetime (7 Replies)
i need to write a bash script that recive a list of varuables
kaka pele ronaldo beckham zidane messi rivaldo gerrard platini
i need the program to print the longest word of the list.
word in the output appears on a separate line and word order in the output is in the order Llachsicografi costs.... (1 Reply)
Hi Guys,
I was going some trial and error to see if I can find the longest word in a text.
I was using Pipes because they are easier to use in this case.
I was stuck on this for a while so I thought I'll get some help with it.
I tried this code to separate all the words in a text in... (4 Replies)
HI All,
I have a file with contents like this:
apple
computer
terminal
applecomputernetworkrouterterminalrouter
network
router
applecomputernetworkrouterterminalrouter
I want to remove all lines with length greater than "18 alphabets". Hence, my output should be:
apple
computer... (1 Reply)
Dear UNIX Community,
I have a set of file paths like the one below:
\\folder name \ folder1 \ folder2 \ folder3 \ folder4
\\folder name \ very long folder name \ even longer name
I would like to find the length of the characters (including space) between the \'s. However, I want... (6 Replies)
I am very new to scripting and need to write a script that will extract the account number from a line that begins with HDR. For example, the file is as follows
HDR2010072600300405505100726 00300405505
LBJ FREEWAY DALLAS
TELEGRAPH ... (9 Replies)
Hi,
I need to insert space between words on my output in UNIX other than the single space given by the space bar on my keyboard, e.g
when are you going. (There should be 4 spaces between each of these words)
rather than
when are you going
Can anyone help me with... (3 Replies)
Hi,
I have a problem where I need to append few spaces(say 10 spaces) for each line in a file whose length is say(100 chars) and others leave as it is.
I tried to find the length of each line and then if the length is say 100 chars then tried to write those lines into another file and use a sed... (17 Replies)
Retaining Spaces within a word
--------------------------------------------------------------------------------
Hi Experts,
I have a 2 GB flat file which have unicode field, some of them are blanks and its size is 4000 character. In the existing system SED command removes the spaces.... (7 Replies)