Programming :: Csh Shell Script - String Concatenation - Add A New Line Character?

May 4, 2009

Inside a loop i'm populating a string variable. Because csh doesn't have very good support for arrays I thought of doing this. I want to add a new line character to the end of the concatenation each time the loop iterates. Then at the end print this variable out.

I tried " and some resources said it was just a "". Neither work. What am I doing wrong?

View 1 Replies


ADVERTISEMENT

Programming :: Replace Character With Hex Value Choosing From Shell Cmd Line?

Jun 9, 2011

I am bouncing a file across platforms (windows->solaris->mainframe), and the file is starting out with a "special" character (the registered trademark "circle R") in some of the records. This character is not in the EBCDIC character set on the MF, so it is unrecognizable. The MF developer I am working with asked if it is possible to replace the character with a specific hex value (AF) before it gets to the MF.

I was putzing around with sed, tr, etc. on the ksh command line, hoping to find an easy way to get one of them to substitute hex instead of ASCII. I have found that the usual shell utilities recognize the trademark character, so homing in on what to replace is solved. But I cannot get anything to actually substitute in the hex sequence I want. E.g. I was thinking something like...

>cat special_file | sed 's/R/AF/g'

But my version of sed does not seem to have hex "editing" capability.

View 5 Replies View Related

Programming :: Uncertain Output Of C++ String Concatenation Program

Sep 15, 2010

The below program is giving unpredictable and wrong output when I compile with g++ under Ubuntu OS , tried with the complier avilable with Ubuntu 8.04 and Ubuntu 10.04 LTS.

But it works fine when complied and ran Redhat g++ 3.4.6

View 5 Replies View Related

Programming :: String Concatenation In Perl Result In Two Lines - Not One?

Jan 11, 2010

I am new to perl and am having trouble adding some strings together.

My full code is below:

The problem is $NewCommandB is always split into two lines, where the second line contains the "/atlas2/<blah>/<etc>/..." string. Since I am generating a .sh file to execute a lot of similar commands I need the string to all be on one line. Any idea why I get this behaviour and any suggestion on how to tell perl to make $NewCommandB a one line string?

Btw for completeness finalFileList.txt contains just file names one line after another:

View 5 Replies View Related

Programming :: Get Value In Character String?

Oct 23, 2010

i am compiling the following program in linux. it's in c language. after the compilation with gcc when i run the executable file. it asks for input. but when i enter a name. i prints "Segmentation fault" and then terminate the program. can you please help me.

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>

[code]....

View 1 Replies View Related

General :: Use The Man / Info / Apropos Pages - Character Instructed The Shell To Interpret A Special Character As An Ordinary Character?

Mar 27, 2010

1.What character instructd the shell to interpret a special character as an ordinary character?

2.What directory contains some of the utilities available on the system in the form of binary files?

3. What command is used to search the location of a utility?

4. What command is used to instruct the editor to write the file and quit the editor?

5. What key quits the more utility and displays the shell prompt?

6. What command starts a child shell as the super user, taking on root's identity and environment?

7. Which wildcard characters can be used for searching all the files in the system that start with "A"?

8. The user name or login name of the super user is????

[Code]....

View 10 Replies View Related

Programming :: Replace The Last Character String?

Jan 19, 2011

how to replace last character string. For example

$>export T1=abcde
$>export T2=xyz

how to get result abcdxyz?

View 10 Replies View Related

Programming :: Pthread - Take String From The Command Line And Creates A Thread To Print The String

May 3, 2011

I've been trying to understand pthread in C a little better. So I made a simple program that takes in a string from the command line and creates a thread to print the string. I've looked online and copied the basic concepts but there are something things I'm confused about. The programs works just fine, but I have questions. Here's what I have so far.

[Code]....

One thing I'd like to know is why the 3rd argument in the pthread_create function which is my SendMessage function needs to be typecasted to a void pointer and then send the address of the function. Also as for the 4th argument, I would see typecasting to void pointer in some of the pthread examples I saw online, but in my case I'm passing a char pointer, would this be correct? In which case would I ever want to pass a void pointer?

Do I need a pthread_exit(NULL) in my main and in the SendMessage function? If so, why? I added the sleep() function so that I could let the pthread_exit function in my SendMessage function execute first. I simply saw that the online examples on pthread had pthread_exit() in both locations.

View 6 Replies View Related

Programming :: Convert String Array To Character?

Aug 18, 2010

i have problem in java. how to convert string array to character. e.g string a[]={"ab","abc","abd","ag"}; what will be the character array ?

View 3 Replies View Related

Programming :: SED Assistance: Add Character In The Middle Of A String?

Oct 20, 2010

I have a folder of MP3s, where some have <artist>- <song> and others have <artist> - <song>. I wanted to make all of them say <artist> - <song>

The command that works for me was

for i in *[a-Z]-*; do mv "$i" "`echo $i | sed 's/-/ -/g'`"; done

but if I -hadn't- used ls with my parameters to filter out the valid results, how would I have done this with sed? I got close with:

ls | sed -e 's/(.*)[a-Z]-(.*)/1 - 2/'

but with the above I lose the [a-Z] character that I used to match with (and I need to keep that).

View 4 Replies View Related

Programming :: Using Sed Replace Line Containing Particular String By A Single String?

Oct 16, 2010

I have a set of lines as ahown below:

Leon went to school
Leon came back from school..
Leon had dinner...

I have to replace the line containing "dinner" by a single string LUNCH...

View 2 Replies View Related

Programming :: String Editing: Remove Lines Consisting Of A Single Character?

Jul 16, 2010

I have a large text file that's formatted sort of like this:

Code:
foo bar
blah

[code]...

View 2 Replies View Related

Programming :: Text File Replace Occurrences Of Three Character String ZZZ With Quotation Mark

Mar 30, 2010

I want to use SED to do the following: In a text file replace any occurrences of the three character string ZZZ with a quotation mark "and. replace all occurrences of a comma with a semi-colon. It is the S/ / / command which is stumping me on the first issue...inparticular how to get the replace string to be quote.

View 9 Replies View Related

Programming :: Insert A Character In Line Using Sed/awk?

Jul 25, 2011

I have a string as below

LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined

Want the above string to be modified as

LogFormat "%h %l %u %D %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined

inserting %D after %u in the string

View 3 Replies View Related

Programming :: Print A Line Of Fill Character In C?

May 15, 2010

As you know, in C++ you can use setfill(char c); and setwidth( int length) to fill a line of a character.
It's line making a line of a character for output

Code:
NAME DEPARTMENT LOCATION
==========================================
Pete R&D Chicago
...
==========================================
As you see, a line of a '=' character drawn to output.

I'm wondering, how can I draw this line in C using printf() to format?
( no loop or repetiton )

View 8 Replies View Related

Programming :: Add A Character To The End Of A Line When A Certain Match Text Is Matched?

Nov 5, 2010

Is there any way to add a character to the end of a line when a certain match text is matched. I have a text file where any line that contacts text XYZ a z is placed at the end.

View 1 Replies View Related

Programming :: Shell Script Comparison For Two File(text) Character Wise?

Mar 1, 2010

I need to write a shell script which can compare two files(text files) character wise. eg. underscore is space.

------FILE 1---------------
A_B_C
D_E_F
G_H_I

[code].....

Actual problem: I need to write a shell script which can give me difference character by character not by line (using comm)

View 4 Replies View Related

Debian Installation :: Distro Upgrade Error "Use Of Uninitialized Value In Concatenation (.) Or String"

Mar 10, 2011

M busy upgrading one of my clients old Debain etch boxes to Lenny but i keep on getting this error.

Use of uninitialized value in concatenation (.) or string at /usr/share/perl5/Debconf/Config.pm line 22.
debconf: delaying package configuration, since apt-utils is not installed dpkg: unrecoverable fatal error, aborting: syntax error: unknown user `root' in statoverride file E: Sub-process /usr/bin/dpkg returned an error code (2)

View 1 Replies View Related

Programming :: Add String On The Beginning And End Of The Line ?

Aug 3, 2010

I need to output of a script to a file with tags.

I'm trying sed and was able to put a tag on the end of the line

Code:

Output is

Quote:

What I need to have is

Quote:

I'm thinking of I redirect my first sed command to a file and then use sed again to put <group> at the beginning of the line. My problem is how to put <group> to all beginning of the string.

View 2 Replies View Related

Programming :: Convert String Into An Integre In Shell Scripting?

Dec 2, 2010

I need to part a string into separate integers ....like "0x0-0xffffffff,0x20000" into 3 integers 0x0 and 0xfffffff and 0x20000.... i can't use any other high-level languages ..

View 3 Replies View Related

Programming :: Copying A String From One File To Another In Shell Script?

Nov 10, 2010

Code:
function forcd
{

[code]...

View 2 Replies View Related

Programming :: How To Append A String To A Next Line In Perl

Apr 9, 2010

I have a requirement like this..this just a sample script...

Code:

when i run this scipt...

Code:

Code:

It is appended in the same line...

I want it to be added to the next line.....

I want to do this by explitly using the filehandles in perl....and not with redirection operators in shell.

View 1 Replies View Related

Programming :: Append Variable String In A Specific Line?

Jun 8, 2010

I want to append a variable string to the end of a specific line. not like append the same string to each line. like in my file i have 4 columns, i want to add a string in 5th column in some fixed row.

View 4 Replies View Related

Programming :: Delete Line In File Matching String?

Jan 26, 2010

Quote:Originally Posted by topcatI would like to know how i can write a shell script to delete a line if a particular pattern exists?E.g. I have a text file with multiple lines. Say 1000s. in the following pattern.

username@email.com:149.0.3.4:1
username1@email.com:149.0.3.4:1
username1@email.net:149.0.3.4:1
username1@email.edu:149.0.3.4:1

If the patternusername@email.com exists then the line "username@email.com:149.0.3.4:1 should be deleted from the file.I have a very similar question but I need to delete one line in a file which matches one very precise instance of a string only. Let's assume I have a file composed of thousands of lines and let's call the file chap-secrets. Let's take the following sample entries:

Code:
#USERNAME SERVER PASSWORD IP
pp pptpd blahblah *

[code]....

View 7 Replies View Related

Programming :: Read A Blank Line Ie A String Of Length 0?

Apr 19, 2010

in gcc how to read a blank line ie a string of length 0.my code:

Code:
#include<stdio.h>
#include<string.h>

[code]...

View 3 Replies View Related

Programming :: Find String In Text File And Add Something To That Line

May 26, 2011

I want to know how can I add something to a specific line.. the output would be something like:
abc
def 123
ghi

Search for string "def" and add something to that line.

View 1 Replies View Related

Programming :: Replace An "entire" Line Containing A Particular String With A New Line?

Mar 12, 2010

I think this can be done using sed. Let's say I have file called, "orig.txt" with following contents:

Code:
[User Prefs]
Ignore Unrequested Popups=1
DevTools Splitter Position=500
History View Style=0

[Code]....

So basically if a line contains the word "Home URL" then go ahead and replace that *entire* line with the supplied *new* line.

View 4 Replies View Related

Programming :: Adding Number And String To Each Line In Data File

Apr 10, 2010

I have a very large data file, with 3 numbers in each line, ex. 3 4 5 ; 6 7 8.I want to add two numbers (0 and 1) at the end of every line, and a string at the beginning of the line. Does anyone know a efficient way to do so?

View 7 Replies View Related

Programming :: Copy String A To String B And Change String B With Toupper() And Count The Chars?

Oct 22, 2010

copy string a to string b and change string b with toupper() and count the chars

View 3 Replies View Related

Programming :: Reading In A Outside Text File And Putting In The String On That Line Into A Char Array That Is Already Allocated?

Mar 29, 2011

Here is the issue. I am reading in a outside text file and putting in the string on that line into a char array that is already allocated.

Code:
int main(int argc, char *argv[])
{

[code]....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved