10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
My file (the output of an experiment) starts off looking like this,
Subjects incorporated to date: 001
Data file started on machine PKSHS260-05CP
Subject 1,... (9 Replies)
Discussion started by: samonl
2. UNIX for Beginners Questions & Answers
I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise
My intention is to insert a line of text after 13th line of every file inside a particular directory.
While trying to do it for a single file , i am using sed
sed '3 i this is the 4th line' filename
sed: command garbled: 3... (5 Replies)
Discussion started by: gotamp
3. Shell Programming and Scripting
Bash/Oracle Linux 6.4
A basic requirement.
How can I get nth line of a file printed ? Can I use grep in this case ?
In the below file, 12th line is "Kernel parameter check passed for rmem_max" . I just want the 12 line to be printed.
# cat sometext.txt
Kernel version check... (2 Replies)
Discussion started by: John K
4. Shell Programming and Scripting
I have a script which reads from a job file and executed the scripts in the job file in sequence.
while read line
# mail the team
The job file will be like
This is working fine. I need to add... (2 Replies)
Discussion started by: nw2unx123
5. Shell Programming and Scripting
May be a simple question but I just began to write unix scripts a week ago, for sorting some huge amount of experiment data, so I got no common sense about unix scripting and really need your helps...
The situation is, I want to read the nth word of mth line in a file, and then store it... (3 Replies)
Discussion started by: freezelty
6. Shell Programming and Scripting
Is there an awk script that can easily perform the following operation?
I have a data file that is in the format of
1945-12,22.3... (3 Replies)
Discussion started by: ncwxpanther
7. Shell Programming and Scripting
For my reuirement, I have to read a file from the 2nd line till the last line<EOF>.
I have a file as test.txt, which as a header record in the first line followed by records in rest of the lines.
for i in `cat test.txt`
While doing the above loop, I have read... (5 Replies)
Discussion started by: machomaddy
8. Shell Programming and Scripting
For example i'm having the below contents in a file:
expr is great when you want to split a string into just two parts. The .* also makes expr good for skipping a variable number of words when you don't know how many words a string will have. But expr is lousy for getting, say, the fourth word... (2 Replies)
Discussion started by: bangarukannan
9. Shell Programming and Scripting
I have a file split.txt with the following contents
Suppose if i want to display contents of line 3, I know this could be achieved using the command
sed -n '3p' split.txt
But I need the line number to be decided dynamically like
sed -n '$ap'... (2 Replies)
Discussion started by: deanamrita
10. Shell Programming and Scripting
So, I want to read line-by-line a text file with unknown number of files....
while ; do
b=`sed -n '$ap' test`
a=`expr $a + 1`
$here do something with b etc
the problem is that sed does not seem to recognise the $a, even when trying
sed -n ' $a p'
So, I cannot read... (3 Replies)
Discussion started by: hakermania