Saturday, 15 September 2012

UNIX: Word Count and file copy command

For word count type 'wc command.

bash -3.2$wc -l File1

The above command will show the total number of words in a file.
The output will be shown like below:

bash -3.2$wc -l File1
  7   22   104 File1

7 denotes total number of lines in a file
22 denotes total number of words in a file ( like 'unix program' means 2 words )
104 denotes total number of characters in a file.

For copying the file
bash -3.2$cp -i File1 newFile

i denotes here the interactive mode.
In this mode unix will as whether you want to overwrite the file or not.

See the screen shot for more details:


No comments:

Post a Comment