Sponsored Content
Top Forums Shell Programming and Scripting Redirecting output from Nth line Post 303021650 by onenessboy on Tuesday 14th of August 2018 08:24:53 AM
Old 08-14-2018
Hi andrew,

Sed works..thank you but I need one more suggestion

I am getting extra , (comma) at end of line, so i need to remove it.. so trying below, but it saying syntax error line 2. at > /home/centos/abc.csv
Code:
#!/bin/bash
sh /home/centos/du.sh | sed 1,124d > /home/centos/abc.csv
for fname in abc.csv
   do
   cat $fname | sed 's/.$//' > tmp.tmp
   mv tmp.tmp $fname
done

------ Post updated at 07:24 AM ------

its working now... used , instead of . in sed
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

redirecting the output of aspell

Hi, I have 2 identical servers both running aspell but for some reason I can't redirect the output to a file on one of them. This is what I'm trying to do: echo feck | aspell -l > errors.txt On one machine this works fine but the other it doesn't (the file is created but it is empty). ... (6 Replies)
Discussion started by: leekb
6 Replies

2. Shell Programming and Scripting

Redirecting OUTPUT

Hi, I want to move the output of a command/script to a file as well as to to be displayed on stdout. Can anybody help me in this. Thanks in advace .. -Chanakya M (1 Reply)
Discussion started by: Chanakya.m
1 Replies

3. Shell Programming and Scripting

extract nth line of all files and print in output file on separate lines.

Hello UNIX experts, I have 124 text files in a directory. I want to extract the 45678th line of all the files sequentialy by file names. The extracted lines should be printed in the output file on seperate lines. e.g. The input Files are one.txt, two.txt, three.txt, four.txt The cat of four... (1 Reply)
Discussion started by: yogeshkumkar
1 Replies

4. UNIX for Dummies Questions & Answers

redirecting script output

Hello, I am interested in taking the output from a script i wrote and using it as input to a different script i wrote. So for example i want to take the output from program2 and use it as a parameter for program1. I didnt think i could use the >> symbols because i think that is just for .txt... (4 Replies)
Discussion started by: GmGeubt
4 Replies

5. Shell Programming and Scripting

How to start reading from the nth line till the last line of a file.

Hi, For my reuirement, I have to read a file from the 2nd line till the last line<EOF>. Say, 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` { echo $i } While doing the above loop, I have read... (5 Replies)
Discussion started by: machomaddy
5 Replies

6. Shell Programming and Scripting

Calculating average for every Nth line in the Nth column

Is there an awk script that can easily perform the following operation? I have a data file that is in the format of 1944-12,5.6 1945-01,9.8 1945-02,6.7 1945-03,9.3 1945-04,5.9 1945-05,0.7 1945-06,0.0 1945-07,0.0 1945-08,0.0 1945-09,0.0 1945-10,0.2 1945-11,10.5 1945-12,22.3... (3 Replies)
Discussion started by: ncwxpanther
3 Replies

7. Shell Programming and Scripting

Extracting lines after nth LINE from an output

Hi all, Here is my problem for which i am breaking my head for past three days.. I have parted command output as follows.. Model: ATA WDC WD5000AAKS-0 (scsi) Disk /dev/sdb: 500GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type ... (3 Replies)
Discussion started by: selvarajvs
3 Replies

8. Shell Programming and Scripting

Redirecting the output

For example, if we run the below command, symcfg list -thin -pool , results in an output most of the times and if the out is generated i'm able to redirect the output to a file. but sometimes it doesnt result any output and even though the output is being redirected, i can see "No Thin Pools "... (2 Replies)
Discussion started by: web2moha
2 Replies

9. UNIX for Beginners Questions & Answers

Insert a line of text on nth line of a file

Hi All, 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
5 Replies

10. Shell Programming and Scripting

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

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
9 Replies
mcx ctty(1)							  USER COMMANDS 						       mcx ctty(1)

  NAME
      mcx ctty - compute betweenness centrality for network nodes

  SYNOPSIS
      mcx ctty [options] [matrix-file]

      mcxctty  is not in actual fact a program. This manual page documents the behaviour and options of the mcx program when invoked in mode ctty.
      The options -h, --apropos, --version, -set, --nop, -progress <num> are accessible in all mcx modes. They are described  in  the  mcx  manual
      page.

      mcx  ctty  [-abc	<fname> (specify label input)] [-imx <fname> (specify matrix input)] [-extent <int> (only consider paths of length at most
      <int>)] [-o <fname> (output file name)] [-tab <fname> (use tab file)] [-t <int> (use <int> threads)] [-J <intJ> (a total of <intJ> jobs  are
      used)]  [-j  <intj>  (this  job has index <intj>)] [-h (print synopsis, exit)] [--apropos (print synopsis, exit)] [--version (print version,
      exit)]

  DESCRIPTION
      mcx ctty computes betweenness centrality for all nodes in a graph, using the between centrality update algorithm from [1].

      The input graph/matrix, if specified with the -imx option, has to be in mcl matrix/graph format. You can use label input	instead  by  using
      the  -abc  option.   Refer  to  mcxio(5) for a description of these two input formats.  By default mcx diameter reads from STDIN and expects
      matrix format.  To specify label input from STDIN use -abc -.

  OPTIONS
      -abc <fname> (label input)
	The file name for input that is in label format.

      -imx <fname> (input matrix)
	The file name for input. STDIN is assumed if not specified.

      -o <fname> (output file name)
	The name of the file to write output to.

      -extent <int> (only consider paths of length at most <int>)
	This option will lead to different results. Results will still be informative however, being representative for the local context in which
	nodes reside. It does probably not make sense to use values smaller than four or five.

      -tab <fname> (use tab file)
	This  option causes the output to be printed with the labels found in the tab file.  With -abc this option will, additionally, construct a
	graph only on the labels found in the tab file.  If this option is used in conjunction with -imx the tab domain and the matrix domain  are
	required to be identical.

      -t <int> (use <int> threads)
      -J <intJ> (a total of <intJ> jobs are used)
      -j <intj> (this job has index <intj>)
	Computing  centrality  scores in a graph is time-intensive.  If you have multiple CPUs available consider using as many threads. Addition-
	ally it is possible to spread the computation over multiple jobs/machines.  Conceptually, each job takes a  number  of	threads  from  the
	total  thread  pool.  If  job control is used (the -J option is used) then the number of jobs should not exceed the number of threads. The
	total number of threads divided by the total number of jobs defines the number of threads that will be used by the current job.  Addition-
	ally,  the  number  of	threads specified signifies the total added amount of all threads across all machines and must be the same for all
	jobs. This number is used by each job to infer its own set of tasks.  The following set of options, if given to as many commands,  defines
	three jobs, each running four threads.

	-t 12 -G 3 -g 0
	-t 12 -G 3 -g 1
	-t 12 -G 3 -g 2

  REFERENCES
      [1]  Ulrik  Brandes, A Faster Algorithm for Betweenness Centrality.  Journal of Mathematical Sociology 25(2): 163-177, (2001).  http://cite-
      seerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.11.2024

  SEE ALSO
      mcxio(5), and mclfamily(7) for an overview of all the documentation and the utilities in the mcl family.

  mcx ctty 12-068						      8 Mar 2012							 mcx ctty(1)
All times are GMT -4. The time now is 04:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy