10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi,
I came across one issue recently where output from one of the columns of the table from where i am creating input file has newline characters hence, record in the file is spread over multiple lines. Fields in the file are separated by pipe (|) delimiter. As header will never have newline... (4 Replies)
Discussion started by: Prathmesh
4 Replies
2. Shell Programming and Scripting
I have a file which comes every day and the file data look's as below.
Vi abc.txt
a|b|c|d\n
a|g|h|j\n
Some times we receive the file with only a new line character in the file like
vi abc.txt
\n (8 Replies)
Discussion started by: rak Kundra
8 Replies
3. Shell Programming and Scripting
Hi,
I am trying to sort a csv file which has say 10 lines each line having a row size that is upto 30183 no. of COLUMNS (Row length = 30183). There is a LINE FEED (LF) at the end of each line. When I try to sort this file say, based on the second FIELD using the below command,
sort -t ',' +1... (5 Replies)
Discussion started by: DHeisenberg
5 Replies
4. Shell Programming and Scripting
Hi below is my file.
cat input.dat
101,abhilash,1000
102,prave
en,2000
103,partha,4
000
10
4,naresh,5000
(its just a example file)
and my output should be:
101,abhilash,1000
102,praveen,2000
103,partha,4000
104,naresh,5000
below is my code
cat input.dat |tr -d '\n' >... (6 Replies)
Discussion started by: abhilash_nakka
6 Replies
5. Shell Programming and Scripting
Hi Gurus,
Need help. I'm a beginner in Unix. I have a requirement, need to add or append newline (\n) character in file.
Sample Data:
1|Main|Test|~#
2|Main|Hello|~#
3|Main|Unix|~#
4|Main|File|~#Output:
1|Main|Test|~#
2|Main|Hello|~#
3|Main|Unix|~#
4|Main|File|~#\n -- append only... (13 Replies)
Discussion started by: Gouri Solleti
13 Replies
6. Shell Programming and Scripting
Hi All,
I have following piece of code in UNIX C Shell script and I want to add one more command which can add newline at the end of file only if there is no newline character exists.
foreach file (`ls $dd_PLAYCARD_EDI_IN`)
if ( -f $dd_PLAYCARD_EDI_IN/${file} ) then
cat -n... (4 Replies)
Discussion started by: jnrohit2k
4 Replies
7. Shell Programming and Scripting
Hello!
I am able to do this in bash, using:
echo -ne HELLO > file.txt
and then, 'HELLO' is written into file.txt without the newline character to be added in the end of the file.
How is this possible to be done using sh instead of bash?
If I try something similar is SH, then inside... (3 Replies)
Discussion started by: hakermania
3 Replies
8. Shell Programming and Scripting
Hi All,
Just need small help in resolving the special new line character in generated output file.
In one of my shell script I am using following lines to get the spool file (i.e. sfile.txt) and
AAA_XXXX_p111_n222.txt
AAA_YYYY_p111_n222.txt
Here assuming
v_pnum="p111"
v_nid="n222"
... (1 Reply)
Discussion started by: shekharjchandra
1 Replies
9. Shell Programming and Scripting
Hi All,
We append the output of a file's size in a file. But a newline character is appended after the variable.
Pls help how to clear this.
filesize=`ls -l test.txt | awk `{print $5}'`
echo File size of test.txt is $filesize bytes >> logfile.txt
The output we got is,
File size of... (4 Replies)
Discussion started by: amio
4 Replies
10. AIX
i am a newbie to shell script,so i want a kshell script in which i need to check for a particular character inside a file through conditional looping(like if ,case,while)and if that character exists ,then substitute a given character to that character.
consider a file test.txt,inside the file... (1 Reply)
Discussion started by: karthikprasathk
1 Replies